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 1165] Setup the v0.1 opportunity endpoints #1213

Merged
merged 16 commits into from
Feb 15, 2024

Conversation

chouinar
Copy link
Collaborator

Summary

Fixes #1165

Time to review: 15 mins

Changes proposed

Added a new set of v0.1 opportunity endpoints which are connected to the DB tables, but don't include filtering yet

Added schemas for the expanded opportunity model

A slight adjustment in the structure of pagination in the request

Quite a bit of restructuring/renaming to have versioning be clearer in-code

Add an environment variable for enabling the v0.1 endpoint - only enabled locally at the moment

Context for reviewers

There are follow-up tickets to setup the endpoint including adding filters and mock data. This PR was already pretty big so aimed to just get things connected and restructured and will later build something a bit more meaningful.

The main thing I did with the renaming was to move the routes+schemas into folders for their specific versions. This way we can avoid naming most of the variables opportunity_blueprint_v0_1 or similar. However, the class name of Marshmallow schemas is registered globally in their internal logic so we can't have two separate OpportunitySchema classes. I'm hoping we won't need another significant version of the opportunity schemas, so preferred naming the existing one v0 and leaving the version out of the new one.

Additional information

Screenshot 2024-02-12 at 1 40 00 PM

The endpoints work locally with the database, returning data as expected. Click the sections below to see the responses.

Click me to see a GET opportunity response
{
  "data": {
    "agency": "US-ABC",
    "applicant_types": [
      "federally_recognized_native_american_tribal_governments",
      "other_native_american_tribal_organizations"
    ],
    "category": "continuation",
    "category_explanation": null,
    "created_at": "2024-02-12T18:40:35.832388+00:00",
    "funding_categories": [
      "education",
      "employment_labor_and_training"
    ],
    "funding_instruments": [
      "other"
    ],
    "modified_comments": null,
    "opportunity_assistance_listings": [
      {
        "assistance_listing_number": "16.870",
        "program_title": "Hill Group"
      },
      {
        "assistance_listing_number": "59.831",
        "program_title": "Wall and Sons"
      },
      {
        "assistance_listing_number": "10.403",
        "program_title": "Dixon, Salas and Gonzalez"
      }
    ],
    "opportunity_id": 4,
    "opportunity_number": "ABC-4-XYZ-001",
    "opportunity_title": "Research into Field seismologist industry",
    "revision_number": 0,
    "summary": {
      "additional_info_url": "grants.gov",
      "additional_info_url_description": "Click me for additional info",
      "agency_code": "US-ABC",
      "agency_contact_description": "For more information contact us at - Foreign reach minute evening environment option form. Serve pick land management lot international. Field news finish fly result.",
      "agency_email_address": "[email protected]",
      "agency_email_address_description": "Contact US Alphabetical Basic Corp via email",
      "agency_name": "US Alphabetical Basic Corp",
      "agency_phone_number": "123-456-0003",
      "applicant_eligibility_description": "Property today share serious inside hotel argue. Look final material product management. Particular food compare recognize factor reduce option your. Box garden then plant offer this man. Back wife open pull. House firm hear true.",
      "archive_date": "2024-01-27",
      "award_ceiling": 8000000,
      "award_floor": 2666667,
      "close_date": "2024-01-24",
      "close_date_description": "Debate draw show science firm station into.",
      "estimated_total_program_funding": 8000000,
      "expected_number_of_awards": 3,
      "funding_category_description": null,
      "is_cost_sharing": false,
      "opportunity_status": "archived",
      "post_date": "2024-02-03",
      "summary_description": "Example summary - Week adult hair factor. Court itself end six music especially."
    },
    "updated_at": "2024-02-12T18:40:35.832388+00:00"
  },
  "message": "Success",
  "pagination_info": null,
  "status_code": 200,
  "warnings": []
}
Click me to see a POST opportunities (search) response
{
  "data": [
    {
      "agency": "US-ABC",
      "applicant_types": [
        "unrestricted",
        "other"
      ],
      "category": "discretionary",
      "category_explanation": null,
      "created_at": "2024-02-12T18:40:36.086758+00:00",
      "funding_categories": [
        "income_security_and_social_services",
        "law_justice_and_legal_services",
        "natural_resources"
      ],
      "funding_instruments": [
        "grant",
        "cooperative_agreement",
        "other"
      ],
      "modified_comments": null,
      "opportunity_assistance_listings": [
        {
          "assistance_listing_number": "01.878",
          "program_title": "Hill, Chambers and Brown"
        },
        {
          "assistance_listing_number": "43.779",
          "program_title": "Mcneil Ltd"
        }
      ],
      "opportunity_id": 10,
      "opportunity_number": "ABC-10-XYZ-001",
      "opportunity_title": "Research into Engineer, automotive industry",
      "revision_number": 0,
      "summary": {
        "additional_info_url": "grants.gov",
        "additional_info_url_description": "Click me for additional info",
        "agency_code": "US-ABC",
        "agency_contact_description": "For more information contact us at - Ball support player real billion.",
        "agency_email_address": "[email protected]",
        "agency_email_address_description": "Contact US Alphabetical Basic Corp via email",
        "agency_name": "US Alphabetical Basic Corp",
        "agency_phone_number": "123-456-0009",
        "applicant_eligibility_description": null,
        "archive_date": "2024-02-29",
        "award_ceiling": 4175000,
        "award_floor": 278333,
        "close_date": "2024-02-28",
        "close_date_description": "Maintain door weight poor adult.",
        "estimated_total_program_funding": 4175000,
        "expected_number_of_awards": 15,
        "funding_category_description": "New successful different enter hundred might building week.",
        "is_cost_sharing": true,
        "opportunity_status": "forecasted",
        "post_date": "2024-02-10",
        "summary_description": "Example summary - Environment home herself reflect summer act life at. Admit suffer doctor pick."
      },
      "updated_at": "2024-02-12T18:40:36.086758+00:00"
    },
    {
      "agency": "US-XYZ",
      "applicant_types": [
        "county_governments",
        "state_governments"
      ],
      "category": "other",
      "category_explanation": "Category as chosen by order #120",
      "created_at": "2024-02-12T18:40:36.150937+00:00",
      "funding_categories": [
        "opportunity_zone_benefits",
        "regional_development",
        "science_technology_and_other_research_and_development"
      ],
      "funding_instruments": [
        "cooperative_agreement",
        "other",
        "procurement_contract"
      ],
      "modified_comments": null,
      "opportunity_assistance_listings": [
        {
          "assistance_listing_number": "89.273",
          "program_title": "Foster, Brown and Ray"
        },
        {
          "assistance_listing_number": "85.071",
          "program_title": "Bell and Sons"
        }
      ],
      "opportunity_id": 11,
      "opportunity_number": "ABC-11-XYZ-001",
      "opportunity_title": "Research into Occupational hygienist industry",
      "revision_number": 0,
      "summary": {
        "additional_info_url": "google.com",
        "additional_info_url_description": "Click me for additional info",
        "agency_code": "US-XYZ",
        "agency_contact_description": "For more information contact us at - Available assume expert although ten recently book. Security that would on recent soon.",
        "agency_email_address": "[email protected]",
        "agency_email_address_description": "Contact US Xylophone Yak Zoo via email",
        "agency_name": "US Xylophone Yak Zoo",
        "agency_phone_number": "123-456-0010",
        "applicant_eligibility_description": "Onto might cut simply collection if. Believe likely task question somebody. Around carry interest bed probably full article. Must game analysis type not weight give. Property care miss any this.",
        "archive_date": "2024-01-25",
        "award_ceiling": 7530000,
        "award_floor": 376500,
        "close_date": "2024-01-23",
        "close_date_description": "Three few draw boy thousand seven.",
        "estimated_total_program_funding": 7530000,
        "expected_number_of_awards": 20,
        "funding_category_description": "Middle wear gun sit themselves.",
        "is_cost_sharing": true,
        "opportunity_status": "archived",
        "post_date": "2024-01-30",
        "summary_description": "Example summary - Worry why science when. Door amount majority situation. Item reduce thus."
      },
      "updated_at": "2024-02-12T18:40:36.150937+00:00"
    },
    {
      "agency": "US-123",
      "applicant_types": [
        "city_or_township_governments"
      ],
      "category": "earmark",
      "category_explanation": null,
      "created_at": "2024-02-12T18:40:36.225715+00:00",
      "funding_categories": [
        "transportation",
        "affordable_care_act",
        "other"
      ],
      "funding_instruments": [
        "grant"
      ],
      "modified_comments": null,
      "opportunity_assistance_listings": [
        {
          "assistance_listing_number": "16.711",
          "program_title": "Gonzalez PLC"
        },
        {
          "assistance_listing_number": "38.607",
          "program_title": "Roberson, Brown and Henderson"
        },
        {
          "assistance_listing_number": "69.310",
          "program_title": "House, Blackwell and Zuniga"
        }
      ],
      "opportunity_id": 12,
      "opportunity_number": "ABC-12-XYZ-001",
      "opportunity_title": "Research into Commercial/residential surveyor industry",
      "revision_number": 0,
      "summary": {
        "additional_info_url": "grants.gov",
        "additional_info_url_description": "Click me for additional info",
        "agency_code": "US-123",
        "agency_contact_description": "For more information contact us at - Choice record answer mention when east somebody. Person significant pick explain often case. Weight rate these cultural part age admit.",
        "agency_email_address": "[email protected]",
        "agency_email_address_description": "Contact US Number Department via email",
        "agency_name": "US Number Department",
        "agency_phone_number": "123-456-0011",
        "applicant_eligibility_description": "Bill skin indeed item mind win accept. Mrs professional late company sound. Rich source interesting success.",
        "archive_date": "2024-02-28",
        "award_ceiling": 2390000,
        "award_floor": 199167,
        "close_date": "2024-03-02",
        "close_date_description": "Explain prepare along company.",
        "estimated_total_program_funding": 2390000,
        "expected_number_of_awards": 12,
        "funding_category_description": "Such subject set forget him poor arm.",
        "is_cost_sharing": true,
        "opportunity_status": "forecasted",
        "post_date": "2024-01-31",
        "summary_description": "Example summary - Say night charge onto agree study. Thank agency boy know."
      },
      "updated_at": "2024-02-12T18:40:36.225715+00:00"
    }
  ],
  "message": "Success",
  "pagination_info": {
    "order_by": "opportunity_id",
    "page_offset": 4,
    "page_size": 3,
    "sort_direction": "ascending",
    "total_pages": 9,
    "total_records": 25
  },
  "status_code": 200,
  "warnings": []
}

@github-actions github-actions bot added documentation Improvements or additions to documentation python api database labels Feb 12, 2024
@chouinar chouinar merged commit 170e7db into main Feb 15, 2024
@chouinar chouinar deleted the chouinar/1165-opportunity-api branch February 15, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api database documentation Improvements or additions to documentation python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Create the expanded search API endpoint
3 participants