Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into chouinar/125-agency-table
Browse files Browse the repository at this point in the history
  • Loading branch information
chouinar committed Sep 10, 2024
2 parents 3a7a128 + 6b485e4 commit 9fe7ba4
Show file tree
Hide file tree
Showing 83 changed files with 3,137 additions and 2,649 deletions.
4 changes: 3 additions & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
# The build stage that will be used to deploy to the various environments
# needs to be called `release` in order to integrate with the repo's
# top-level Makefile
FROM python:3-slim AS base
FROM python:3.12-slim AS base
# See /documentation/api/package-depedency-management.md#Upgrading Python
# for details on upgrading your Python version

# Install poetry, the package manager.
# https://python-poetry.org
Expand Down
19 changes: 10 additions & 9 deletions api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,22 @@ setup-local:
build:
docker compose build

start:
start: ## Start the API
docker compose up --detach

start-debug:
docker compose -f docker-compose.yml -f docker-compose.debug.yml up --detach

run-logs: start
run-logs: start ## Start the API and follow the logs
docker compose logs --follow --no-color $(APP_NAME)

init: build init-db init-opensearch init-localstack

clean-volumes: ## Remove project docker volumes (which includes the DB state)
clean-volumes: ## Remove project docker volumes - which includes the DB, and OpenSearch state
docker compose down --volumes

volume-recreate: clean-volumes init ## Destroy current volumes, setup new ones - will remove all existing data

stop:
docker compose down

Expand All @@ -126,9 +128,6 @@ start-db:
docker compose up --detach grants-db
./bin/wait-for-local-db.sh

## Destroy current DB, setup new one
db-recreate: clean-volumes init-db

#########################
# DB Migrations
#########################
Expand Down Expand Up @@ -166,7 +165,7 @@ db-migrate-history: ## Show migration history
db-migrate-heads: ## Show migrations marked as a head
$(alembic_cmd) heads $(args)

db-seed-local:
db-seed-local: ## Generate records into your local database
$(PY_RUN_CMD) db-seed-local $(args)

db-check-migrations: ## Verify the DB schema matches the DB migrations generated
Expand All @@ -183,8 +182,7 @@ setup-postgres-db: ## Does any initial setup necessary for our local database to
# Opensearch
##################################################

init-opensearch: start-opensearch
# TODO - in subsequent PRs, we'll add more to this command to setup the search index locally
init-opensearch: start-opensearch ## Start the opensearch service locally

start-opensearch:
docker compose up --detach opensearch-node
Expand Down Expand Up @@ -275,6 +273,9 @@ setup-foreign-tables:
seed-local-legacy-tables:
$(PY_RUN_CMD) python3 -m tests.lib.seed_local_legacy_tables

populate-search-opportunities: ## Load opportunities from the DB into the search index, run "make db-seed-local" first to populate your database
$(FLASK_CMD) load-search-data load-opportunity-data $(args)

##################################################
# Miscellaneous Utilities
##################################################
Expand Down
2 changes: 1 addition & 1 deletion api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ See [development.md](../documentation/api/development.md) for installation and d
* [Formatting and Linting](../documentation/api/formatting-and-linting.md)
* [Writing Tests](../documentation/api/writing-tests.md)
* [Logging configuration](../documentation/api/monitoring-and-observability/logging-configuration.md)
* [Loggin conventions](../documentation/api/monitoring-and-observability/logging-conventions.md)
* [Logging conventions](../documentation/api/monitoring-and-observability/logging-conventions.md)
9 changes: 8 additions & 1 deletion api/local.env
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,11 @@ ENABLE_OPPORTUNITY_LOG_MSG=false
# For the script to setup the foreign data tables
# this env var overrides it so the script generates normal
# tables that don't need to connect to an Oracle database
IS_LOCAL_FOREIGN_TABLE=true
IS_LOCAL_FOREIGN_TABLE=true

############################
# Task Configuration
############################

# File path for the export_opportunity_data task
EXPORT_OPP_DATA_FILE_PATH=/tmp
182 changes: 182 additions & 0 deletions api/openapi.generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ paths:
one_of:
- forecasted
- posted
post_date:
start_date: '2024-01-01'
end_date: '2024-02-01'
close_date:
start_date: '2024-01-01'
pagination:
order_by: opportunity_id
page_offset: 1
Expand Down Expand Up @@ -215,6 +220,37 @@ paths:
page_offset: 1
page_size: 100
sort_direction: ascending
example5:
summary: Filter by award fields
value:
filters:
expected_number_of_awards:
min: 5
award_floor:
min: 10000
award_ceiling:
max: 1000000
estimated_total_program_funding:
min: 100000
max: 250000
pagination:
order_by: opportunity_id
page_offset: 1
page_size: 25
sort_direction: descending
example6:
summary: FIlter by assistance listing numbers
value:
filters:
assistance_listing_number:
one_of:
- '43.001'
- '47.049'
pagination:
order_by: opportunity_id
page_offset: 1
page_size: 25
sort_direction: descending
security:
- ApiKeyAuth: []
/v0.1/opportunities/search:
Expand Down Expand Up @@ -826,6 +862,112 @@ components:
type: string
minLength: 2
example: USAID
AssistanceListingNumberFilterV1:
type: object
properties:
one_of:
type: array
minItems: 1
items:
type: string
pattern: ^\d{2}\.\d{2,3}$
example: '45.149'
IsCostSharingFilterV1:
type: object
properties:
one_of:
type:
- array
- 'null'
items:
type: boolean
example: true
ExpectedNumberAwardsFilterV1:
type: object
properties:
min:
type:
- integer
- 'null'
minimum: 0
example: 0
max:
type:
- integer
- 'null'
minimum: 0
example: 25
AwardFloorFilterV1:
type: object
properties:
min:
type:
- integer
- 'null'
minimum: 0
example: 0
max:
type:
- integer
- 'null'
minimum: 0
example: 10000
AwardCeilingFilterV1:
type: object
properties:
min:
type:
- integer
- 'null'
minimum: 0
example: 0
max:
type:
- integer
- 'null'
minimum: 0
example: 10000000
EstimatedTotalProgramFundingFilterV1:
type: object
properties:
min:
type:
- integer
- 'null'
minimum: 0
example: 0
max:
type:
- integer
- 'null'
minimum: 0
example: 10000000
PostDateFilterV1:
type: object
properties:
start_date:
type:
- string
- 'null'
format: date
end_date:
type:
- string
- 'null'
format: date
CloseDateFilterV1:
type: object
properties:
start_date:
type:
- string
- 'null'
format: date
end_date:
type:
- string
- 'null'
format: date
OpportunitySearchFilterV1:
type: object
properties:
Expand Down Expand Up @@ -854,6 +996,46 @@ components:
- object
allOf:
- $ref: '#/components/schemas/AgencyFilterV1'
assistance_listing_number:
type:
- object
allOf:
- $ref: '#/components/schemas/AssistanceListingNumberFilterV1'
is_cost_sharing:
type:
- object
allOf:
- $ref: '#/components/schemas/IsCostSharingFilterV1'
expected_number_of_awards:
type:
- object
allOf:
- $ref: '#/components/schemas/ExpectedNumberAwardsFilterV1'
award_floor:
type:
- object
allOf:
- $ref: '#/components/schemas/AwardFloorFilterV1'
award_ceiling:
type:
- object
allOf:
- $ref: '#/components/schemas/AwardCeilingFilterV1'
estimated_total_program_funding:
type:
- object
allOf:
- $ref: '#/components/schemas/EstimatedTotalProgramFundingFilterV1'
post_date:
type:
- object
allOf:
- $ref: '#/components/schemas/PostDateFilterV1'
close_date:
type:
- object
allOf:
- $ref: '#/components/schemas/CloseDateFilterV1'
OpportunityPaginationV1:
type: object
properties:
Expand Down
Loading

0 comments on commit 9fe7ba4

Please sign in to comment.