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

Refactor export stage to use a config dict representing the workbook structure #221

Open
jeancochrane opened this issue Feb 28, 2024 · 0 comments
Labels
pipeline Code that glues all the model bits together

Comments

@jeancochrane
Copy link
Contributor

When you add or remove a column from the desk review workbook template used by the export pipeline stage (misc/desk_review_template.xlsx), you currently have to adjust all the individual references to integer and/or letter column positions for columns that come after your new column(s) in pipeline/export.R, as well as tweak the code to add any necessary formatting to the column. This is annoying and error-prone.

I think a better design would be refactor the pipeline stage to use a centralized data structure like a dictionary of dictionaries to read all of the position and formatting metadata about every column, so that adding or removing a column only requires updating the one data structure. I'm imagining something like:

workbook_schema <- list(
  pin_detail_sheet = list(
    pin = list(formula = true),
    ...
    land_rate_sf = list(style = style_comma),
    ...
  ),
  card_detail_sheet = list( ... ),
  comparables_sheet = list( ... )
)

Using this kind of data structure, the position of each column could be determined with a which() call and the column's name, and the code could be updated to iterate the list of columns and apply formatting appropriately.

@dfsnow dfsnow added the pipeline Code that glues all the model bits together label Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pipeline Code that glues all the model bits together
Projects
None yet
Development

No branches or pull requests

2 participants