Federal Account Page - fedspendingtransparency/usaspending-website GitHub Wiki
Federal Account Page Visualizations
The federal account page contains:
- A Sankey diagram and text narrative for the current fiscal year (not affected by filters)
- Spending Over Time
- Spending by Category
- Spending by Award
Sankey and Narrative
The Sankey and text narrative do not respond to any filters.
Unfiltered
GET /federal_accounts/:id/
- Where
:id
is the database primary key for this federal account. - Despite the name, this API call will return margin information about the federal account: the account's name and fragments of its account symbol.
POST /tas/balances/total/
{
"group": "reporting_period_start",
"field": "gross_outlay_amount_by_tas_cpe",
"aggregate": "sum",
"order": ["reporting_period_start"],
"filters": [{
"field": "treasury_account_identifier__federal_account_id",
"operation": "equals",
"value": 2357
}, {
"field": ["reporting_period_start", "reporting_period_end"],
"operation": "range_intersect",
"value": 2017,
"value_format": "fy"
}]
}
Rationale: This API call returns only the Gross Outlay value for the federal account aggregated over the current fiscal year. The current API design is only capable of aggregating values for one field at a time, so this API call needs to be performed multiple times. This API call needs to be repeated with the following field
values to obtain all the values required to generate the Sankey and text narrative:
budget_authority_unobligated_balance_brought_forward_fyb
- Balance brought forward (part 1)adjustments_to_unobligated_balance_brought_forward_cpe
- Balance brought forward (part 2)other_budgetary_resources_amount_cpe
- Other budgetary resourcesbudget_authority_appropriated_amount_cpe
- New appropriationsbudget_authority_available_amount_total_cpe
- Budget Authorityobligations_incurred_total_by_tas_cpe
- Obligated balanceunobligated_balance_cpe
- Unobligated amountgross_outlay_amount_by_tas_cpe
- Gross Outlay
Note: You must sum both balance brought forward values to get the full balance brought forward amount.
Spending Over Time
The Spending Over Time has a number of possible combinations that result in different API calls. This visualization is further complicated by the fact that, like the Sankey, API limitations only return one set of values per call, so multiple calls (to different endpoints!) must be made to generate the visualization.
This visualization may be rendered in years or quarters, both of which result in different API endpoints even when the filters are consistent between the two.
This visualization may be filtered with obligation filters and non-obligation filters. Obligation filters are:
- Object class
- Program activity
Non-obligation filters are anything else.
Unfiltered (Years)
POST /tas/balances/total/
{
"filters": [{
"field": "treasury_account_identifier__federal_account_id",
"operation": "equals",
"value": 2357
}],
"group": ["submission__reporting_fiscal_year"],
"field": "adjustments_to_unobligated_balance_brought_forward_cpe",
"aggregate": "sum",
"order": ["submission__reporting_fiscal_year"],
}
You will need to perform this API call for the following fields:
budget_authority_unobligated_balance_brought_forward_fyb
- Balance brought forward (part 1)adjustments_to_unobligated_balance_brought_forward_cpe
- Balance brought forward (part 2)other_budgetary_resources_amount_cpe
- Other budgetary resourcesbudget_authority_appropriated_amount_cpe
- New Appropriationsgross_outlay_amount_by_tas_cpe
- Gross outlaybudget_authority_available_amount_total_cpe
- Budget Authorityobligations_incurred_total_by_tas_cpe
- Obligated balanceunobligated_balance_cpe
- Unobligated amount
Unfiltered (Quarters)
POST /tas/balances/quarters/total/
{
"filters": [{
"field": "treasury_account_identifier__federal_account_id",
"operation": "equals",
"value": 2357
}],
"group": ["submission__reporting_fiscal_year", "submission__reporting_fiscal_quarter"],
"field": "budget_authority_appropriated_amount_cpe",
"aggregate": "sum",
"order": ["submission__reporting_fiscal_year"]
}
You will need to perform this API call for the following fields:
budget_authority_unobligated_balance_brought_forward_fyb
- Balance brought forward (part 1)adjustments_to_unobligated_balance_brought_forward_cpe
- Balance brought forward (part 2)other_budgetary_resources_amount_cpe
- Other budgetary resourcesbudget_authority_appropriated_amount_cpe
- New Appropriationsgross_outlay_amount_by_tas_cpe
- Gross outlaybudget_authority_available_amount_total_cpe
- Budget Authorityobligations_incurred_total_by_tas_cpe
- Obligated balanceunobligated_balance_cpe
- Unobligated amount
Non-Obligation Filters (Years)
POST /tas/balances/total/
{
"filters": [{
"field": "submission__reporting_fiscal_year",
"operation": "in",
"value": ["2015"]
}, {
"field": "treasury_account_identifier__federal_account_id",
"operation": "equals",
"value": 2357
}],
"group": ["submission__reporting_fiscal_year"],
"field": "budget_authority_unobligated_balance_brought_forward_fyb",
"aggregate": "sum",
"order": ["submission__reporting_fiscal_year"]
}
You will need to perform this API call for the following fields:
budget_authority_unobligated_balance_brought_forward_fyb
- Balance brought forward (part 1)adjustments_to_unobligated_balance_brought_forward_cpe
- Balance brought forward (part 2)other_budgetary_resources_amount_cpe
- Other budgetary resourcesbudget_authority_appropriated_amount_cpe
- New Appropriationsgross_outlay_amount_by_tas_cpe
- Gross outlaybudget_authority_available_amount_total_cpe
- Budget Authorityobligations_incurred_total_by_tas_cpe
- Obligated balanceunobligated_balance_cpe
- Unobligated amount
Non-Obligation Filters (Quarters)
POST /tas/balances/quarters/total/
{
"filters": [{
"field": "submission__reporting_fiscal_year",
"operation": "in",
"value": ["2015"]
}, {
"field": "treasury_account_identifier__federal_account_id",
"operation": "equals",
"value": 2357
}],
"group": ["submission__reporting_fiscal_year", "submission__reporting_fiscal_quarter"],
"field": "other_budgetary_resources_amount_cpe",
"aggregate": "sum",
"order": ["submission__reporting_fiscal_year"]
}
You will need to perform this API call for the following fields:
budget_authority_unobligated_balance_brought_forward_fyb
- Balance brought forward (part 1)adjustments_to_unobligated_balance_brought_forward_cpe
- Balance brought forward (part 2)other_budgetary_resources_amount_cpe
- Other budgetary resourcesbudget_authority_appropriated_amount_cpe
- New Appropriationsgross_outlay_amount_by_tas_cpe
- Gross outlaybudget_authority_available_amount_total_cpe
- Budget Authorityobligations_incurred_total_by_tas_cpe
- Obligated balanceunobligated_balance_cpe
- Unobligated amount
Obligation Filters (Years)
POST /tas/categories/total/
{
"filters": [{
"field": "treasury_account__federal_account_id",
"operation": "equals",
"value": 2357
}, {
"field": "object_class__major_object_class",
"operation": "in",
"value": ["30"]
}],
"group": ["submission__reporting_fiscal_year"],
"field": "gross_outlay_amount_by_program_object_class_cpe",
"aggregate": "sum",
"order": ["submission__reporting_fiscal_year"]
}
You will need to perform this API call for these fields:
obligations_incurred_by_program_object_class_cpe
- Obligated balance (that matches filter values)gross_outlay_amount_by_program_object_class_cpe
- Outlay
POST /tas/balances/total/
{
"filters": [{
"field": "treasury_account_identifier__federal_account_id",
"operation": "equals",
"value": 2357
}, {
"field": "treasury_account_identifier__program_balances__object_class__major_object_class",
"operation": "in",
"value": ["30"]
}],
"group": ["submission__reporting_fiscal_year"],
"field": "unobligated_balance_cpe",
"aggregate": "sum",
"order": ["submission__reporting_fiscal_year"]
}
You will need to perform this API call for these fields:
budget_authority_available_amount_total_cpe
- Budget Authorityunobligated_balance_cpe
- Unobligated amount
Note: When obligation filters are selected, an additional Obligated Balance (Other) segment is displayed in the visualization. This value is calculated using:
Other Obligated = Budget Authority - Unobligated - Obligated Filtered
Obligation Filters (Quarters)
POST /tas/categories/quarters/total/
{
"filters": [{
"field": "treasury_account__federal_account_id",
"operation": "equals",
"value": 2357
}, {
"field": "object_class__major_object_class",
"operation": "in",
"value": ["30"]
}],
"group": ["submission__reporting_fiscal_year", "submission__reporting_fiscal_quarter"],
"field": "gross_outlay_amount_by_program_object_class_cpe",
"aggregate": "sum",
"order": ["submission__reporting_fiscal_year"]
}
You will need to perform this API call for these fields:
obligations_incurred_by_program_object_class_cpe
- Obligated balance (that matches filter values)gross_outlay_amount_by_program_object_class_cpe
- Outlay
POST /tas/balances/quarters/total/
{
"filters": [{
"field": "treasury_account_identifier__federal_account_id",
"operation": "equals",
"value": 2357
}, {
"field": "treasury_account_identifier__program_balances__object_class__major_object_class",
"operation": "in",
"value": ["30"]
}],
"group": ["submission__reporting_fiscal_year", "submission__reporting_fiscal_quarter"],
"field": "budget_authority_available_amount_total_cpe",
"aggregate": "sum",
"order": ["submission__reporting_fiscal_year"]
}
You will need to perform this API call for these fields:
budget_authority_available_amount_total_cpe
- Budget Authorityunobligated_balance_cpe
- Unobligated amount
Note: When obligation filters are selected, an additional Obligated Balance (Other) segment is displayed in the visualization. This value is calculated using:
Other Obligated = Budget Authority - Unobligated - Obligated Filtered
Combination Filters (Years)
POST /tas/categories/total/
{
"filters": [{
"field": "treasury_account__federal_account_id",
"operation": "equals",
"value": 2357
}, {
"field": "object_class__major_object_class",
"operation": "in",
"value": ["30"]
}],
"group": ["submission__reporting_fiscal_year"],
"field": "gross_outlay_amount_by_program_object_class_cpe",
"aggregate": "sum",
"order": ["submission__reporting_fiscal_year"]
}
You will need to perform this API call for these fields:
obligations_incurred_by_program_object_class_cpe
- Obligated balance (that matches filter values)gross_outlay_amount_by_program_object_class_cpe
- Outlay
POST /tas/balances/total/
{
"filters": [{
"field": "treasury_account_identifier__federal_account_id",
"operation": "equals",
"value": 2357
}, {
"field": "treasury_account_identifier__program_balances__object_class__major_object_class",
"operation": "in",
"value": ["30"]
}],
"group": ["submission__reporting_fiscal_year"],
"field": "unobligated_balance_cpe",
"aggregate": "sum",
"order": ["submission__reporting_fiscal_year"]
}
You will need to perform this API call for these fields:
budget_authority_available_amount_total_cpe
- Budget Authorityunobligated_balance_cpe
- Unobligated amount
Note: When obligation filters are selected, an additional Obligated Balance (Other) segment is displayed in the visualization. This value is calculated using:
Other Obligated = Budget Authority - Unobligated - Obligated Filtered
Combination Filters (Quarters)
POST /tas/categories/quarters/total/
{
"filters": [{
"field": "treasury_account__federal_account_id",
"operation": "equals",
"value": 2357
}, {
"field": "object_class__major_object_class",
"operation": "in",
"value": ["30"]
}],
"group": ["submission__reporting_fiscal_year", "submission__reporting_fiscal_quarter"],
"field": "gross_outlay_amount_by_program_object_class_cpe",
"aggregate": "sum",
"order": ["submission__reporting_fiscal_year"]
}
You will need to perform this API call for these fields:
obligations_incurred_by_program_object_class_cpe
- Obligated balance (that matches filter values)gross_outlay_amount_by_program_object_class_cpe
- Outlay
POST /tas/balances/quarters/total/
{
"filters": [{
"field": "treasury_account_identifier__federal_account_id",
"operation": "equals",
"value": 2357
}, {
"field": "treasury_account_identifier__program_balances__object_class__major_object_class",
"operation": "in",
"value": ["30"]
}],
"group": ["submission__reporting_fiscal_year", "submission__reporting_fiscal_quarter"],
"field": "budget_authority_available_amount_total_cpe",
"aggregate": "sum",
"order": ["submission__reporting_fiscal_year"]
}
You will need to perform this API call for these fields:
budget_authority_available_amount_total_cpe
- Budget Authorityunobligated_balance_cpe
- Unobligated amount
Note: When obligation filters are selected, an additional Obligated Balance (Other) segment is displayed in the visualization. This value is calculated using:
Other Obligated = Budget Authority - Unobligated - Obligated Filtered
Spending by Category
POST /tas/categories/total/
{
"group": "program_activity__program_activity_name",
"field": "obligations_incurred_by_program_object_class_cpe",
"aggregate": "sum",
"order": ["-aggregate"],
"filters": [{
"field": "treasury_account__federal_account",
"operation": "equals",
"value": 2357
}],
"page": 1,
"limit": 5
}
Group values:
program_activity__program_activity_name
- Program Activityobject_class__object_class_name
- Object classtreasury_account__tas_rendering_label
- TAS
Spending by Award
POST /awards/
{
"page": 1,
"fields": ["id", "piid", "fain", "uri", "recipient", "period_of_performance_start_date", "period_of_performance_current_end_date", "total_obligation", "type_description", "funding_agency"],
"filters": [{
"field": "type",
"operation": "in",
"value": ["A", "B", "C", "D"]
}, {
"field": "financial_set__treasury_account__federal_account",
"operation": "equals",
"value": 2357
}],
"order": ["-total_obligation"],
"limit": 60
}