Common Transformations

Adding Supervisor District or Analysis Neighborhood

The transformation can be done after the data is loaded into the open data portal utilizing the Region Code Function. You just have to add a new column and apply this formula to it:

  • Start on the dataset's information page (example)

  • If you have edit permissions, click on on "Edit" in the upper right corner

  • Click "Review Data" in the Review and Configure Data box

  • Click "+Add Column" on the left-hand bar

  • Add a name and description, and add "No Source" in the Source Column dropdown (this will create a blank column), then add a data type and click "Done"

  • Back in the Review Data tab, scroll to your new column, click the three dots next to the column name, and select "Data Transforms"

  • Using the formula box, type in the Region Code Function (snippet below), test it by hitting "run"

forgive(region_code_label(<sourcecolumn>,'{4X4 of the lookup dataset}','data_column'))
  • After verifying it is running, return to the draft homepage and click "Update"

Current Supervisor District:

  • forgive(region_code_label(<point_column>,'cqbw-m5m3','sup_dist'))

Analysis Neighborhood:

  • forgive(region_code_label(<point_column>,'sevw-6tgi','neighborhoods_analysis_boundaries'))

Adding a "data_published_at" field

This can also be done within socrata after the dataset is loaded using the same process as region code transforms (above), but using a different code snipped in the data transformation box:

to_floating_timestamp(source_created_at(), 'US/Pacific')

Last updated