Skip to content

Commit

Permalink
Merge pull request #2045 from fedspendingtransparency/staging
Browse files Browse the repository at this point in the history
Sprint 90 Production Deploy
  • Loading branch information
tony-sappe authored Sep 20, 2019
2 parents bf369cb + 30d5830 commit 60e7cdb
Show file tree
Hide file tree
Showing 157 changed files with 2,052 additions and 285,761 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
language: python

python:
- "3.5"
- '3.5'
- '3.7'

services:
- postgresql

addons:
postgresql: "10"
postgresql: '10'
apt:
packages:
- postgresql-10
Expand All @@ -23,7 +24,7 @@ before_install:
- npm install [email protected] --global

install:
- pip install -r requirements/requirements.txt
- if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then travis_retry pip install -r requirements/requirements_3-7.txt; else travis_retry pip install -r requirements/requirements.txt; fi
- pip install coveralls

before_script:
Expand All @@ -35,6 +36,7 @@ before_script:

script:
- flake8
- if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then black --check . ; fi
- python manage.py check_for_endpoint_documentation
- pytest --cov=usaspending_api
# - dredd (Disable dredd until test data is loaded into DB for API responses)
Expand Down
2 changes: 1 addition & 1 deletion loading_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ This will load data into your USAspending database in the following order:

## Historic USAspending Data

*This section needs to be updated. The commands listed below may be different than those in the current version of the USAspending API.*
**This section desperately needs to be updated. The commands listed below are most definitely obsolete.**

Award data from the [current USAspending site](https://www.usaspending.gov/) comes in two different formats:
- Contracts
Expand Down
67 changes: 67 additions & 0 deletions requirements/requirements_3-7.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
appdirs==1.4.3
asyncpg==0.18.3
atomicwrites==1.3.0
attrs==19.1.0
black==19.3b0
boto3==1.9.224
botocore==1.12.224
certifi==2019.6.16
chardet==3.0.4
codeclimate-test-reporter==0.2.3
coverage==4.3.4
dj-database-url==0.5.0
django-cors-headers==1.2.2
django-debug-toolbar==1.7
django-extensions==1.7.5
django-filter==0.14.0
django-partial-index==0.5.2
django-queryset-csv==1.0.1
django-simple-history==1.8.2
django-spaghetti-and-meatballs==0.2.2
Django>=1.11.0,<2.0
djangorestframework==3.9.4
docutils==0.15.2
drf-extensions==0.3.1
drf-tracking==1.4.0
elasticsearch==6.3.0
entrypoints==0.3
et-xmlfile==1.0.1
filechunkio==1.8
fiscalyear==0.1.0
flake8==3.7.8
git+https://github.com/fedspendingtransparency/django-mock-queries#egg=django-mock-queries
idna==2.8
importlib-metadata==0.20
jdcal==1.4.1
jmespath==0.9.4
jsonpickle==1.2
Markdown==3.1.1
mccabe==0.6.1
mock==3.0.5
model-mommy==1.6.0
more-itertools==7.2.0
numpy==1.17.2
openpyxl==2.4.7
pandas==0.25.1
pip>=19.2
pluggy==0.12.0
psycopg2-binary==2.7.5
py-gfm==0.1.3
py==1.8.0
pycodestyle==2.5.0
pyflakes==2.1.1
pytest-cov==2.5.1
pytest-django==3.2.1
pytest==3.10.1
python-dateutil==2.7.3
python-json-logger==0.1.9
pytz==2019.2
requests==2.22.0
retrying==1.3.3
s3transfer==0.2.1
six==1.12.0
sqlparse==0.3.0
unicodecsv==0.14.1
urllib3>=1.25,<1.26
xlrd==1.0.0
zipp==0.6.0
68 changes: 0 additions & 68 deletions sample_api.json

This file was deleted.

283,320 changes: 0 additions & 283,320 deletions test.json

This file was deleted.

2 changes: 2 additions & 0 deletions usaspending_api/accounts/v2/views/budget_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ListBudgetFunctionViewSet(APIView):
This route sends a request to the backend to retrieve all Budget Functions associated with a TAS,
ordered by Budget Function code.
"""

endpoint_doc = "usaspending_api/api_docs/api_documentation/budget_functions/list_budget_function.md"

@cache_response()
Expand All @@ -31,6 +32,7 @@ class ListBudgetSubfunctionViewSet(APIView):
This route sends a request to the backend to retrieve all Budget Subfunctions associated with a TAS,
ordered by Budget Subfunction code. Can be filtered by Budget Function.
"""

endpoint_doc = "usaspending_api/api_docs/api_documentation/budget_functions/list_budget_subfunction.md"

@cache_response()
Expand Down
4 changes: 4 additions & 0 deletions usaspending_api/accounts/views/federal_accounts_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ObjectClassFederalAccountsViewSet(APIView):
"""
Returns financial spending data by object class.
"""

endpoint_doc = "usaspending_api/api_docs/api_documentation/federal_account/available_object_classes.md"

@cache_response()
Expand Down Expand Up @@ -77,6 +78,7 @@ class FiscalYearSnapshotFederalAccountsViewSet(APIView):
This route sends a request to the backend to retrieve budget information for a federal account.
If no fiscal year is used, the federal accounts most recent fiscal year is used.
"""

endpoint_doc = "usaspending_api/api_docs/api_documentation/federal_account/fiscal_year_snapshot.md"

@cache_response()
Expand Down Expand Up @@ -426,6 +428,7 @@ class FederalAccountViewSet(APIView):
"""
This route sends a request to the backend to retrieve a federal account based on its federal_account_code.
"""

endpoint_doc = "usaspending_api/api_docs/api_documentation/federal_account/federal_account.md"

@cache_response()
Expand All @@ -444,6 +447,7 @@ class FederalAccountsViewSet(APIView):
"""
This route sends a request to the backend to retrieve a list of federal accounts.
"""

endpoint_doc = "usaspending_api/api_docs/api_documentation/federal_account/federal_account.md"

def _parse_and_validate_request(self, request_dict):
Expand Down
1 change: 1 addition & 0 deletions usaspending_api/accounts/views/federal_obligations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class FederalAccountByObligationViewSet(CachedDetailViewSet):
"""
Returns a Appropriation Account Balance's obligated amount broken up by TAS.
"""

endpoint_doc = "usaspending_api/api_docs/api_documentation/federal_obligations.md"

serializer_class = FederalAccountByObligationSerializer
Expand Down
1 change: 1 addition & 0 deletions usaspending_api/accounts/views/financial_balances.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class AgenciesFinancialBalancesViewSet(CachedDetailViewSet):
"""
Returns financial balances by agency and the latest quarter for the given fiscal year.
"""

endpoint_doc = "usaspending_api/api_docs/api_documentation/financial_balances/agencies.md"

serializer_class = AgenciesFinancialBalancesSerializer
Expand Down
2 changes: 2 additions & 0 deletions usaspending_api/accounts/views/financial_spending.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ObjectClassFinancialSpendingViewSet(CachedDetailViewSet):
"""
Returns financial spending data by object class for the latest quarter based on the given fiscal year.
"""

endpoint_doc = "usaspending_api/api_docs/api_documentation/financial_spending/major_object_class.md"

serializer_class = ObjectClassFinancialSpendingSerializer
Expand Down Expand Up @@ -94,6 +95,7 @@ class MinorObjectClassFinancialSpendingViewSet(CachedDetailViewSet):
"""
Returns financial spending data by object class for the latest quarter in the given fiscal year.
"""

endpoint_doc = "usaspending_api/api_docs/api_documentation/financial_spending/object_class.md"

serializer_class = MinorObjectClassFinancialSpendingSerializer
Expand Down
70 changes: 70 additions & 0 deletions usaspending_api/api_contracts/contracts/v2/awards/accounts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
FORMAT: 1A
HOST: https://api.usaspending.gov

# Award Federal Accounts

These endpoints are used to power USAspending.gov's Award Summary page Federal Accounts visualization section.

## List Federal Accounts [/api/v2/awards/accounts/]

This endpoint returns a list of federal accounts under a given award.

### List Federal Accounts [POST]
+ Request (application/json)
+ Attributes
+ `award_id`:`CONT_AWD_DEAC5206NA25396_8900_-NONE-_-NONE-` (required, string)
Award to return accounts for
+ `page`: 1 (optional, number)
Page number to return
+ `limit`: 10 (optional, number)
Maximum number to return
+ `order`: `desc` (optional, string)
Direction of sort
+ `sort`:`total_transaction_obligated_amount` (optional, string)
The field to sort on

+ Response 200 (application/json)
+ Attributes
+ `results` (required, array[AccountListing], fixed-type)
+ `page_metadata` (required, PageMetadata, fixed-type)
+ Body

{
"results": [
{
"total_transaction_obligated_amount": 1234.56,
"federal_account": "075-1301",
"account_title": "Bureau of Consumer Financial Protection Fund",
"funding_agency_abbreviation": "NIH",
"funding_agency_name": "National Institutes of Health",
"funding_agency_id": 123
}
],
"page_metadata": {
"page": 1,
"next": 2,
"count": 4,
"previous": 1,
"hasNext": true,
"hasPrevious": false
}
}


# Data Structures

## PageMetadata (object)
+ `page` (required, number)
+ `next` (required, number, nullable)
+ `count` (required, number)
+ `previous` (required, number, nullable)
+ `hasNext` (required, boolean)
+ `hasPrevious` (required, boolean)

## AccountListing (object)
+ `total_transaction_obligated_amount` (required, number)
+ `federal_account` (required, string)
+ `account_title` (required, string)
+ `funding_agency_abbreviation` (required, string)
+ `funding_agency_name` (required, string)
+ `funding_agency_id` (required, number)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FORMAT: 1A
HOST: https://api.usaspending.gov

# Award Funding Rollup [/api/v2/awards/funding_rollup/]

This endpoint returns the total transaction obligations and count of awarding agencies, funding agencies, and federal accounts for an award.

## POST

+ Request (application/json)
+ Attributes (object)
+ `award_id`: `CONT_AWD_DEAC5206NA25396_8900_-NONE-_-NONE-` (required, string)
+ Response 200 (application/json)
+ Attributes
+ `total_transaction_obligated_amount` (required, number)
+ `awarding_agency_count` (required, number)
+ `funding_agency_count` (required, number)
+ `federal_account_count` (required, number)
+ Body

{
"total_transaction_obligated_amount": 42946881.56,
"awarding_agency_count": 27,
"funding_agency_count": 28,
"federal_account_count": 47
}
Loading

0 comments on commit 60e7cdb

Please sign in to comment.