Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue #1167] Add filtering to the search endpoint #1468

Merged
merged 24 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f9c051d
WIP
chouinar Feb 26, 2024
b31a094
Merge branch 'main' into chouinar/next-iteration-of-db-tables
chouinar Feb 29, 2024
99b24fe
WIP
chouinar Mar 5, 2024
86ee26d
Add DB migrations, fix factories, adjust tests temporarily
chouinar Mar 5, 2024
4aa3731
Fix factory inconsistency
chouinar Mar 5, 2024
e585861
[Issue #1364] Update API schema with modified DB schema fields
chouinar Mar 5, 2024
579de15
Support very very large award amounts
chouinar Mar 5, 2024
e3b1b2e
Merge branch 'chouinar/next-iteration-of-db-tables' into chouinar/136…
chouinar Mar 5, 2024
111dc77
WIP
chouinar Mar 6, 2024
65f6add
Making never null columns not nullable
chouinar Mar 6, 2024
869f62c
Merge branch 'chouinar/next-iteration-of-db-tables' into chouinar/136…
chouinar Mar 6, 2024
34b431e
Update database ERD diagrams
nava-platform-bot Mar 6, 2024
c361ef2
Cleanup
chouinar Mar 6, 2024
64d7aa6
WIP
chouinar Mar 7, 2024
b7f5985
Redo migrations with updated tables
chouinar Mar 7, 2024
7ab8873
Merge branch 'chouinar/next-iteration-of-db-tables' into chouinar/136…
chouinar Mar 7, 2024
95ea3cb
Merge branch 'main' into chouinar/1364-update-api-schema
chouinar Mar 7, 2024
126bdb0
[Issue #1167] Add filtering to the search endpoint
chouinar Mar 12, 2024
5bbb1d7
Minor adjustments
chouinar Mar 12, 2024
7093a41
Update OpenAPI spec
nava-platform-bot Mar 12, 2024
3c52f93
Merge branch 'main' into chouinar/1167-add-filtering
chouinar Mar 14, 2024
831df5f
Update database ERD diagrams
nava-platform-bot Mar 14, 2024
c020d3b
Fixing a significant bug where less than the number of specified reco…
chouinar Mar 14, 2024
aba0201
Minor comment fix
chouinar Mar 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
337 changes: 268 additions & 69 deletions api/openapi.generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,47 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/OpportunitySearchRequest'
examples:
example1:
summary: No filters
value:
pagination:
order_by: opportunity_id
page_offset: 1
page_size: 25
sort_direction: ascending
example2:
summary: All filters
value:
query: research
filters:
agency:
one_of:
- US-ABC
- HHS
applicant_type:
one_of:
- state_governments
- county_governments
- individuals
funding_category:
one_of:
- recovery_act
- arts
- natural_resources
funding_instrument:
one_of:
- cooperative_agreement
- grant
opportunity_status:
one_of:
- forecasted
- posted
pagination:
order_by: opportunity_id
page_offset: 1
page_size: 25
sort_direction: descending
security:
- ApiKeyAuth: []
/v0/opportunities/{opportunity_id}:
Expand Down Expand Up @@ -727,6 +768,130 @@ components:
type: string
format: date-time
readOnly: true
FundingInstrumentFilter:
type: object
properties:
one_of:
type: array
items:
enum:
- cooperative_agreement
- grant
- procurement_contract
- other
type:
- string
FundingCategoryFilter:
type: object
properties:
one_of:
type: array
items:
enum:
- recovery_act
- agriculture
- arts
- business_and_commerce
- community_development
- consumer_protection
- disaster_prevention_and_relief
- education
- employment_labor_and_training
- energy
- environment
- food_and_nutrition
- health
- housing
- humanities
- infrastructure_investment_and_jobs_act
- information_and_statistics
- income_security_and_social_services
- law_justice_and_legal_services
- natural_resources
- opportunity_zone_benefits
- regional_development
- science_technology_and_other_research_and_development
- transportation
- affordable_care_act
- other
type:
- string
ApplicantTypeFilter:
type: object
properties:
one_of:
type: array
items:
enum:
- state_governments
- county_governments
- city_or_township_governments
- special_district_governments
- independent_school_districts
- public_and_state_institutions_of_higher_education
- private_institutions_of_higher_education
- federally_recognized_native_american_tribal_governments
- other_native_american_tribal_organizations
- public_and_indian_housing_authorities
- nonprofits_non_higher_education_with_501c3
- nonprofits_non_higher_education_without_501c3
- individuals
- for_profit_organizations_other_than_small_businesses
- small_businesses
- other
- unrestricted
type:
- string
OpportunityStatusFilter:
type: object
properties:
one_of:
type: array
items:
enum:
- forecasted
- posted
- closed
- archived
type:
- string
AgencyFilter:
type: object
properties:
one_of:
type: array
items:
type: string
minLength: 2
example: US-ABC
OpportunitySearchFilter:
type: object
properties:
funding_instrument:
type:
- object
allOf:
- $ref: '#/components/schemas/FundingInstrumentFilter'
funding_category:
type:
- object
allOf:
- $ref: '#/components/schemas/FundingCategoryFilter'
applicant_type:
type:
- object
allOf:
- $ref: '#/components/schemas/ApplicantTypeFilter'
opportunity_status:
type:
- object
allOf:
- $ref: '#/components/schemas/OpportunityStatusFilter'
agency:
type:
- object
allOf:
- $ref: '#/components/schemas/AgencyFilter'
OpportunityPagination:
type: object
properties:
Expand Down Expand Up @@ -761,6 +926,15 @@ components:
OpportunitySearchRequest:
type: object
properties:
query:
type: string
description: Query string which searches against several text fields
example: research
filters:
type:
- object
allOf:
- $ref: '#/components/schemas/OpportunitySearchFilter'
pagination:
type:
- object
Expand All @@ -784,17 +958,6 @@ components:
OpportunitySummary:
type: object
properties:
opportunity_status:
description: The current status of the opportunity
example: !!python/object/apply:src.constants.lookup_constants.OpportunityStatus
- posted
enum:
- forecasted
- posted
- closed
- archived
type:
- string
summary_description:
type: string
description: The summary of the opportunity
Expand All @@ -803,10 +966,15 @@ components:
type: boolean
description: Whether or not the opportunity has a cost sharing/matching
requirement
is_forecast:
type: boolean
description: Whether the opportunity is forecasted, that is, the information
is only an estimate and not yet official
example: false
close_date:
type: string
format: date
description: The date that the opportunity will close
description: The date that the opportunity will close - only set if is_forecast=False
close_date_description:
type: string
description: Optional details regarding the close date
Expand Down Expand Up @@ -844,6 +1012,35 @@ components:
type: string
description: The text to display for the additional_info_url link
example: Click me for more info
forecasted_post_date:
type: string
format: date
description: Forecasted opportunity only. The date the opportunity is expected
to be posted, and transition out of being a forecast
forecasted_close_date:
type: string
format: date
description: Forecasted opportunity only. The date the opportunity is expected
to be close once posted.
forecasted_close_date_description:
type: string
description: Forecasted opportunity only. Optional details regarding the
forecasted closed date.
example: Proposals will probably be due on this date
forecasted_award_date:
type: string
format: date
description: Forecasted opportunity only. The date the grantor plans to
award the opportunity.
forecasted_project_start_date:
type: string
format: date
description: Forecasted opportunity only. The date the grantor expects the
award recipient should start their project
fiscal_year:
type: integer
description: Forecasted opportunity only. The fiscal year the project is
expected to be funded and launched
funding_category_description:
type: string
description: Additional information about the funding category
Expand Down Expand Up @@ -877,63 +1074,6 @@ components:
type: string
description: The text for the link to the agency email address
example: Click me to email the agency
Opportunity:
type: object
properties:
opportunity_id:
type: integer
readOnly: true
description: The internal ID of the opportunity
example: 12345
opportunity_number:
type: string
description: The funding opportunity number
example: ABC-123-XYZ-001
opportunity_title:
type: string
description: The title of the opportunity
example: Research into conservation techniques
agency:
type: string
description: The agency who created the opportunity
example: US-ABC
category:
description: The opportunity category
example: !!python/object/apply:src.constants.lookup_constants.OpportunityCategory
- discretionary
enum:
- discretionary
- mandatory
- continuation
- earmark
- other
type:
- string
category_explanation:
type: string
description: Explanation of the category when the category is 'O' (other)
example: null
revision_number:
type: integer
description: The current revision number of the opportunity, counting starts
at 0
example: 0
modified_comments:
type: string
description: Details regarding what modification was last made
example: null
opportunity_assistance_listings:
type: array
items:
type:
- object
allOf:
- $ref: '#/components/schemas/OpportunityAssistanceListing'
summary:
type:
- object
allOf:
- $ref: '#/components/schemas/OpportunitySummary'
funding_instruments:
type: array
items:
Expand Down Expand Up @@ -999,6 +1139,65 @@ components:
- unrestricted
type:
- string
Opportunity:
type: object
properties:
opportunity_id:
type: integer
readOnly: true
description: The internal ID of the opportunity
example: 12345
opportunity_number:
type: string
description: The funding opportunity number
example: ABC-123-XYZ-001
opportunity_title:
type: string
description: The title of the opportunity
example: Research into conservation techniques
agency:
type: string
description: The agency who created the opportunity
example: US-ABC
category:
description: The opportunity category
example: !!python/object/apply:src.constants.lookup_constants.OpportunityCategory
- discretionary
enum:
- discretionary
- mandatory
- continuation
- earmark
- other
type:
- string
category_explanation:
type: string
description: Explanation of the category when the category is 'O' (other)
example: null
opportunity_assistance_listings:
type: array
items:
type:
- object
allOf:
- $ref: '#/components/schemas/OpportunityAssistanceListing'
summary:
type:
- object
allOf:
- $ref: '#/components/schemas/OpportunitySummary'
opportunity_status:
description: The current status of the opportunity
example: !!python/object/apply:src.constants.lookup_constants.OpportunityStatus
- posted
enum:
- forecasted
- posted
- closed
- archived
type:
- string
created_at:
type: string
format: date-time
Expand Down
Loading