Skip to content
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

Fixes vector ingestion to slugify column names #970

Merged
merged 1 commit into from
Jun 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion data/h3_data_importer/vector_folder_to_h3_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def vector_file_to_h3dataframe(
if not h3df.empty:
# we want h3index as hex, do we?
h3df.index = pd.Series(h3df.index).apply(lambda x: hex(x))
# slugify column name to be ColumnName as everywhere else
h3df = h3df.rename(columns={column: slugify(column)})
return h3df


Expand Down Expand Up @@ -168,7 +170,7 @@ def main(
if len(vectors) == 1: # folder just contains one vector file
df = vector_file_to_h3dataframe(vectors[0], column, h3_res)
create_h3_grid_table(table, df, conn)
insert_to_h3_grid_table(table, df, conn) # apply multiprocessing here if needed
insert_to_h3_grid_table(table, df, conn)
# slugify the column name to follow the convention of db column naming
column = slugify(column)
insert_to_h3_data_and_contextual_layer_tables(table, column, h3_res, dataset, category, year, conn)
Expand Down