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

fix: Pass appropriate kwargs to dummy data generators #2325

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

rebkwok
Copy link
Contributor

@rebkwok rebkwok commented Dec 18, 2024

This lets dataset definitions run with the cli use the new additional_population_constraints

Copy link

cloudflare-workers-and-pages bot commented Dec 19, 2024

Deploying databuilder-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: e83d013
Status: ✅  Deploy successful!
Preview URL: https://6ba14e0f.databuilder.pages.dev
Branch Preview URL: https://dummy-data-kwargs.databuilder.pages.dev

View logs

Copy link
Contributor

@evansd evansd left a comment

Choose a reason for hiding this comment

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

Thanks for catching this. I'd like to have a think about what kind of testing approach would have stopped this making it into prod, but that's a wider question.

Now that we're returning kwargs I think there might be a slightly more straightforward factoring here, along the lines of:

def get_dummy_data_generator(variable_definitions, dummy_data_config):
    if dummy_data_config.legacy:
        return DummyDataGenerator(variable_definitions, ...)
    else:
        return NextGenDummyDataGenerator(variable_definitions, ...)

Returning a reference to the class and the constructor kwargs feels like unnecessary indirection at this point.

@rebkwok
Copy link
Contributor Author

rebkwok commented Dec 19, 2024

Thanks for catching this. I'd like to have a think about what kind of testing approach would have stopped this making it into prod, but that's a wider question.

Now that we're returning kwargs I think there might be a slightly more straightforward factoring here, along the lines of:

def get_dummy_data_generator(variable_definitions, dummy_data_config):
    if dummy_data_config.legacy:
        return DummyDataGenerator(variable_definitions, ...)
    else:
        return NextGenDummyDataGenerator(variable_definitions, ...)

Returning a reference to the class and the constructor kwargs feels like unnecessary indirection at this point.

Yeah, I'd thought about doing it that way, happy to change it

@rebkwok rebkwok merged commit 78038d7 into main Dec 19, 2024
8 checks passed
@rebkwok rebkwok deleted the dummy-data-kwargs branch December 19, 2024 12:53
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