HHS / simpler-grants-gov

https://simpler.grants.gov
Other
42 stars 13 forks source link

Look into adjusting the naming / data structure of the agency data in the opportunity response #2371

Open chouinar opened 3 weeks ago

chouinar commented 3 weeks ago

Summary

Right now an opportunity returns the following relevant agency information in our API (fake data):

{
    "agency": "HHS-NIH11",
    "top_level_agency_name": "Department of Health and Human Services",
    "agency_name": "National Institutes of Health",
    "summary": {
      "agency_code": "USAID",
      "agency_contact_description": "google.com Contact Center\nHours of operation are 24 hours a day, 7 days a week.\nchristinarosales@example.org",
      "agency_email_address": "mark90@example.net",
      "agency_email_address_description": "Contact National Housing Administration via email",
      "agency_name": "National Housing Administration",
      "agency_phone_number": "123-456-0002",
    }
  }

The agency data is stored across two parts of the API response, two fields in the top-level, and the rest in the summary object. The agency code, and name appear twice as well, and are not consistent with one another.

This is almost certainly going to be confusing for users of the API, and we should correct this issue.

--

Context on why it is this way:

From prior investigation, the agency code is almost never different between the two levels, but there are a few specific cases where they are (not intentional as far as I can tell - likely just an old bug). The top-level values are better supported/accurate and we shouldn't keep the agency code / agency name of the inner summary object.

--

Recommendation:

As the only user of our API at this time is the front-end, we would just need to temporarily add another field at the top-level, and have them switch over.

This will make the request look like:

{
    "agency_code": "HHS-NIH11",
    "top_level_agency_name": "Department of Health and Human Services",
    "agency_name": "National Institutes of Health",
    "summary": {
      "agency_contact_description": "google.com Contact Center\nHours of operation are 24 hours a day, 7 days a week.\nchristinarosales@example.org",
      "agency_email_address": "mark90@example.net",
      "agency_email_address_description": "Contact National Housing Administration via email",
      "agency_phone_number": "123-456-0002",
    }
  }

--

Note that the DB will continue to contain a few extra fields for now, we can clean that up later.

Acceptance criteria

emilycnava commented 2 days ago

Looking into this