Recalculate & Show Building Ward Data + Ward Pages#178
Conversation
Next Steps:
|
✅ Deploy Preview for radiant-cucurucho-d09bae ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
vkoves
left a comment
There was a problem hiding this comment.
@wangbertha - this looks good, and I support keeping this a separate PR that just adds the corrected wards! I have a few notes, but the other big one is let's add some tests! I'd think it could be super simple, like confirming three known buildings get mapped to the right wards.
Based on improved pyproject.toml format
Returns -1 if there is no Ward number
|
In-Progress: Adding tests, and resolving data discrepancies! |
|
@vkoves I integrated the 3 methods to find Ward numbers into the data pipeline. I think we should use the City Geocoding method, so I added tests that run against that method. |
|
|
||
| // TODO: Figure out a way to get metaInfo working without any | ||
| // https://github.com/xerebede/gridsome-starter-typescript/issues/37 | ||
| @Component<any>({ |
Check warning
Code scanning / ESLint
Disallow the `any` type Warning
vkoves
left a comment
There was a problem hiding this comment.
@wangbertha - great work! I poked a few buildings and the ward numbers seemed sound, so I helped you out on the front-end and added the ward number to each building, and made a quick "Ward" template, so that you can see buildings for each ward 🎉
This was a highly requested featured by our advocates and should help us target specific alderman!
| Building Page | Ward Page |
|---|---|
![]() |
![]() |
My asks:
- Now that you've tried the three different approaches, can we trim down the final output to one, and maybe call it
WardCalculatedor something? (to make clear it's not what comes from the raw data) - I appreciate you adding README's to your files, but should you add anything to the overall
READMEto make sure folks re-run your code when there's a new data update?
Alternatively, we could also just call it Ward, since the city field is called Wards, and the final data is ultimately for us 🤷🏻♂️
|
@vkoves Thank you for the review! I have made your requested updates. I called the final column I also updated the individual building page to display Let me know if any other changes would be necessary or helpful! |
| elif building['WardByGMapsCoordinates'] == building['WardByGMapsCoordinates']: | ||
| return -4 | ||
| return -5 | ||
| # def find_ward_number_by_obj_coordinates(ward_shapes: pd.DataFrame, coordinatesStr: str) -> int | None: |
There was a problem hiding this comment.
@wangbertha - should this code just be deleted? We shouldn't merge in large blocks of commented code
There was a problem hiding this comment.
Yes, I can delete these! Do you think I should also remove the source files for the methods we are not using? Those would be BuildingCoordinates.csv and WardShapes.csv.
There was a problem hiding this comment.
I think the shapes might be useful (for future rendering) but I trust your judgement on that. It's fine if we have unused code if we have a plan to use it in the future, but you can always come back to this PR and retrieve code if you need it again!
There was a problem hiding this comment.
Makes sense! I'll remove them for now, so that if they are used later, they will be associated with the PR that uses them for rendering. Plus, it doesn't take long to add them!
|
|
||
| 2. To then process a new CSV file (at `src/data/source/ChicagoEnergyBenchmarking.csv`), you need to run the following command: | ||
| 2. If you update the [Chicago Energy Benchmarking Data](https://data.cityofchicago.org/Environment-Sustainable-Development/Chicago-Energy-Benchmarking/xq83-jr8c/about_data) | ||
| (`src/data/source/ChicagoEnergyBenchmarking.csv`), you need to update `src/data/source/CityGeocoder.xlsx` by following the |
There was a problem hiding this comment.
I missed this earlier, so we can handle it next time, but why did this end up being an XLSX file? I swear it was a CSV before, because I checked it 🤔
I think for the follow up it would also be helpful to explain what that file is. I also notice in the geocode process that it takes the whole file and a manual process, but since buildings don't shift over time, we probably want to make a process that only geocodes new addresses. That can be a future improvement though!
vkoves
left a comment
There was a problem hiding this comment.
Had one last comment, but not going to block this, especially with EcoFest tomorrow! I don't think I fully understood how the geocode process works, but now that I do I have some thoughts for future improvement
|
The typo you caught earlier was actually a typo for another ward method! The City Geocoder takes in and outputs an Excel file. There might be a way to pull the data through an API call (perhaps as used in the WardWise project), where we might be able to reduce manual steps even more. Agreed that we can optimize the script further to just query new buildings! |


Description
This pull request calculates and adds Ward number to the data that is used for the individual buildings pages (Issue #56).
Requesting review on standalone functions and call point in the data pipeline before next steps (next steps are in the subsequent comment).
Fixes #56
Testing Instructions
The function to add Ward number may be tested by running
add_ward_numbers.py.Checklist: