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:
The top-level agency field is actually the agency code of the opportunity
The top-level agency_name is found by joining the agency field with the agency table
The summary fields are fields attached to the opportunity summary itself in the DB, which is partially a duplicate of the top-level values and a static copied value of the actual agency info
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:
Remove agency_code and agency_name from the summary object
Rename the "agency" field in the top-level object to "agency_code" to be clearer.
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.
Summary
Right now an opportunity returns the following relevant agency information in our API (fake data):
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:
agency
field is actually the agency code of the opportunityagency_name
is found by joining the agency field with the agency tableFrom 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:
--
Note that the DB will continue to contain a few extra fields for now, we can clean that up later.
Acceptance criteria