Skip to content

[PULL REQUEST] Add PopulationSim Datalake Exporter Script - #99

Open
anneku wants to merge 4 commits into
mainfrom
feature/datalake-exporter
Open

[PULL REQUEST] Add PopulationSim Datalake Exporter Script#99
anneku wants to merge 4 commits into
mainfrom
feature/datalake-exporter

Conversation

@anneku

@anneku anneku commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Describe this pull request. What changes are being made?
Adds a new script datalake_exporter.py that reads PopulationSim CSV output files from a specified directory, converts them to Parquet format, and uploads them to Azure Data Lake Storage under popsim/<output_folder>/<timestamp>/. The timestamp is derived from the modification time of synthetic_persons.csv so each run is stored in a unique versioned folder.

What issues does this pull request address?
This script provides an automated, repeatable way to export PopulationSim outputs to the data lake, replacing any manual upload process.

Additional context

  • Supports both dev and prod environments
  • env argument is required and must be explicitly passed as dev or prod
  • CSVs are converted to Parquet using PyArrow
  • Upload errors are caught per file so a single failure does not abort the entire export
  • A summary of succeeded and failed files is printed at the end
  • Can be run directly from the command line or called from a batch file

@anneku
anneku requested a review from JiaXu1024 May 21, 2026 00:26
@JiaXu1024

Copy link
Copy Markdown
Contributor

Below are my comments:

Comment thread python/datalake_exporter.py Outdated
# HOW TO RUN
# -----------------------------------------------------------------------
# Step 1 — Activate the uv environment in command prompt:
# C:\uv_env\asim_140\.venv\Scripts\activate

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update populaitonsim environment to have dependencies required for data lake.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JiaXu1024 I updated the datalake_exporter to use the sandag-population-sim venv. Note that the Python version in the venv is quite outdated — you may want to consider upgrading it.

Comment thread python/datalake_exporter.py Outdated
# C:\uv_env\asim_140\.venv\Scripts\activate
#
# Step 2 — Run the script:
# Usage: python datalake_exporter_popsim.py <output_path> <env>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it okay calling the script in the main.py for different years?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write_to_datalake is now called from main.py

@anneku
anneku force-pushed the feature/datalake-exporter branch from 105ecb6 to 511038c Compare July 21, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants