-
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
feat: populate database with admin boundaries #852
base: main
Are you sure you want to change the base?
Conversation
Should only merge after 1.5.1 release |
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 added a few non-blocking comments. It's hard to test the full functionality as it integrates with BigQuery. As this is a non-user-facing function, we can do an entire testing exercise after merging to QA. If any issues are encountered, we can fix them in a future PR
### Input | ||
The function expects an HTTP POST request with a JSON payload containing: | ||
- **`country_code`** (required): The ISO 3166-1 alpha-2 code of the country (e.g., `"FR"` for France). | ||
- **`admin_levels`** (optional): A comma-separated list of administrative levels to process (e.g., `"2,4,6"`). If not provided, the function calculates levels automatically. |
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.
[question]: As admin_levels
is optional, in case that is not specified, what is the behavior?
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 added this in the PR description but i should probably add it in the README as well:
The levels are determined dynamically if not provided by request parameter:
- Country-Level (ISO 3166-1): The function identifies the base administrative level for the country (e.g., admin_level = 2 for most countries).
- Subdivision Levels (ISO 3166-2): The function automatically extracts subdivision levels (e.g., states, provinces) based on the ISO 3166-2 definitions.
- Additional Levels: Two levels beyond the highest ISO 3166-2-compliant level are included to capture finer subdivisions where applicable.
"description": "Populate the database with reverse geolocation data", | ||
"entry_point": "reverse_geolocation_populate", | ||
"timeout": 3600, | ||
"memory": "8Gi", |
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.
Should we remove the memory
field? I think we are using memory
and available_memory
for the same purpose in different functions.
cloudevents~=1.10.1 | ||
|
||
# Additional packages for this function | ||
gtfs-kit |
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.
Where is this dependency being used?
Summary:
This pull request introduces the new
reverse_geolocation_populate
Cloud Function, designed to populate a PostgreSQL database with administrative boundary polygons and metadata for specified country codes. The function integrates BigQuery for querying OpenStreetMap data and handles administrative levels dynamically based on the input.Key Changes:
New Functionality:
reverse_geolocation_populate
to handle:country_code
andadmin_levels
from the request payload.geoalchemy2
.File Affected:
functions-python/reverse_geolocation_populate/src/main.py
Workflow Integration:
reverse_geolocation_populate
for all ISO-3166-1 country codes, with a concurrency limit of 5.Expected Behavior:
Country-Level Populations:
The function populates the database with administrative boundary polygons for specified country codes, supporting up to the 8th level of administrative boundaries as defined in the [OSM documentation].
The levels are determined dynamically if not provided by request parameter:
admin_level = 2
for most countries).Example Outputs:
Populates provincial boundaries (only iso-3166-2 compliant locations are shown but more administrative boundaries are extracted for Canada).
Populates regions and departments (only iso-3166-2 compliant locations are shown but more administrative boundaries are extracted for France).
Full Workflow Run:
[View Workflow Execution]
Testing Steps:
Database Validation:
GeoPolygon
table to explore populated geometries and verify data integrity.Workflow Validation:
Notes:
Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.sh
to make sure you didn't break anything