-
Notifications
You must be signed in to change notification settings - Fork 21
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
[Forecasted Pipeline] Update grants table in GOST #3212
Comments
@TylerHendrickson I'd love a quick review of the implementation plan before moving this to ready, thanks! |
@TylerHendrickson @jeffsmohan Just want to make sure that |
@masimons Good question! TLDR: My bad, I think we should go with a Deeper explanation: Given that we don't control and thus can't 100% trust the data coming in from this data source, we've generally used Given that this field represents a year, you could also make an argument for using an
Even so, we'd want our system to be robust to eventually a rogue non-year value slipping in. So this becomes design question about where in our flow we want to do the "error handling" of turning an XML value (i.e., text) into a date — we could do it upstream in grants-ingest, in GOST when we insert the data into postgres, or leave it as text and let the frontend handle it, for example. Given that we're storing other date-like values in postgres as |
Just adding my 2¢ on a few things being discussed here:
|
Wanted to leave a comment that the Also, |
Why is this issue important?
We want forecasted grants available in our dataset (alongside active grants) so we can integrate them into the product for our users.
Current State
The
grants
table in the postgres database currently has columns to represent active grants. Meanwhile, the forecasted grants we want to flow through the grants-ingest pipeline have a different set of fields. (Many are shared between the two data types, but each has a few unique ones.)The following is a visual-diff output showing the field name differences between the
OpportunitySynopsisDetail_1_0
(left column) andOpportunityForecastDetail_1_0
(right column) data models:Expected State
We want the
grants
table to be expanded with the columns it will need to track forecasted grants alongside active grants in the same table. We plan to reuse some of these fields that already exist for posted grants. Therefore, the new fields should be:forecast_creation_date
award_date
fiscal_year
grantor_contact_name
grantor_contact_phone_number
Implementation Plan
Write a knex database migration to do the following:
grants
table to add the needed columns (all nullable):forecast_creation_date
(date)award_date
(date)fiscal_year
(date, always Jan 1 for the given year)grantor_contact_name
(text)grantor_contact_phone_number
(text)###Deprecated:
We want the
grants
table to be expanded with the columns it will need to track forecasted grants alongside active grants in the same table:estimated_award_date
estimated_project_start_date
estimated_synopsis_close_date
estimated_synopsis_close_date_explanation
estimated_synopsis_post_date
fiscal_year
grantor_contact_name
grantor_contact_phone_number
is_forecasted
(this is not in the grants.gov data models, but we're including it for easy filtering by state)Implementation Details:
Write a knex database migration to do the following:
Update the
grants
table to add the needed columns (all initially nullable):estimated_award_date
(date)estimated_project_start_date
(date)estimated_synopsis_close_date
(date)estimated_synopsis_close_date_explanation
(text)estimated_synopsis_post_date
(date)fiscal_year
(date, always Jan 1 for the given year)grantor_contact_name
(text)grantor_contact_phone_number
(text)is_forecasted
(boolean)Migrate data in the
grants
table:is_forecasted
tofalse
for all existing rowsUpdate the
is_forecasted
column to set a not nullable constraintNote that all current columns are already nullable except for
grant_id
andcreated_at
. While this may not be ideal, it does mean we don't have migrate any columns to be nullable for this migration.The text was updated successfully, but these errors were encountered: