cityofaustin / atd-moped

A comprehensive mobility project tracking platform for Austin, Texas.
https://mobility.austin.gov/moped/
4 stars 3 forks source link

Create generated columns to show fund name and FDU format in project funding table #1391

Closed mddilley closed 2 months ago

mddilley commented 3 months ago

Associated issues

Closes https://github.com/cityofaustin/atd-data-tech/issues/18450

This PR adds two generated columns to pull the fund name out of the fund jsonb column and pull the fund, department, and unit values out of the fund and dept_unit jsonb columns. We may change the way this data is stored in the future so these fields will give us a way to expose this data consistently over time.

Testing

URL to test:

Local only

Steps to test:

  1. Create a new project and add a new funding row in the Funding sources table within the Funding tab. Don't add values to the Funding or Dept-unit fields in the form yet. Run the SQL shown below on the local database, and you should see that both fund_dept_unit or fund_name are null.
  2. Now, add a value for Funding. Run the SQL shown below on the local database, and you should see that fund_name now shows the value held in the json in the fund column. fund_dept_unit should still be null since there isn't complete data to populate it.
  3. Now, choose a value for Dept-unit. When you run the sql one last time, you should see both fund_name and fund_dept_unit have values now, and they should match the values in the fund and unit columns of the row.
  4. Test the down migration.
SELECT
    project_id,
    fund,
    dept_unit,
    fund_dept_unit,
    fund_name
FROM
    moped_proj_funding
WHERE
    project_id = <your project id>;

Ship list

mddilley commented 2 months ago

@frankhereford It is always a good time for requested changes! Thanks for catching that, and I'm looking at it right now. 🙏

mddilley commented 2 months ago

@frankhereford @johnclary Thanks for your reviews on this today! I pulled out the code for the Bike Share Station because it is feeling like a lot to me, and I'd rather focus on getting this FDU code shipped tomorrow. I'll target the other issue for a patch or the next release.

Just re-requested y'all's review 🙏