-
Notifications
You must be signed in to change notification settings - Fork 4
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
Create ETL that joins crashes and Moped components #1596
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome—this worked like a charm for me 🙌
I have a suggestion about the crash query filter and the python version we're using. Otherwise this looks fantastic!!!
Thanks, Charlie! 🚢 🚢 🚢 🚢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2024-11-13 16:36:06,309 INFO: 511591 rows uploaded...
The logging is nice, being able to follow whats happening. 🚢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested locally, and I saw the staging table truncate and fill back up with records. Always fun to learn more about geo python! 🙌 🚀
|
||
It is recommended to run this script using the docker container. You can build it using: | ||
|
||
Note, if you are on Apple Silicon you may need to add `--platform linux/amd64` to get GDAL to install correctly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏 thanks for this detail because this was the case for me
query_moped = """ | ||
{ | ||
component_arcgis_online_view(where: { geometry: { _is_null: false } }) { | ||
project_component_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commas not creating a syntax error in GraphQL is a TIL for me. Cool to know! https://spec.graphql.org/June2018/#sec-Insignificant-Commas
components.set_index("project_component_id", inplace=True) | ||
crashes.set_index("id", inplace=True) | ||
logger.info(f"Joining crashes spatially to project geometry") | ||
crashes_near_projects = gpd.sjoin(crashes, components, how="inner") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! this is a pretty powerful line, and a TIL for me. 😎
Associated issues
cityofaustin/atd-data-tech#19453
Testing
Steps to test:
First fill out the env_template for Hasura, from 1pass. Make sure you use Moped production and VZ staging credentials
Note, if you are on Apple Silicon you may need to add
--platform linux/amd64
to get GDAL to install correctly.The logging should be pretty self explanatory to see if things succeeded or not.
You can also then check if
moped_component_crashes
was populated with the lookup table. (maybe delete everything in that table yourself to double check if the script did anything).Ship list
main
branch