Skip to content

Fix subsampling when structural IDs are formula-backed #498

@anth-volk

Description

@anth-volk

Problem

Simulation.subsample() rebuilds a simulation from to_input_dataframe(). After safe exports started excluding computed variables by default, formula-backed structural IDs such as person_id can be omitted from the DataFrame used for the rebuild.

This breaks subsampling for country packages where structural IDs are formula-backed rather than plain input variables.

Expected fix

subsample() should preserve computed structural dataset variables for its internal rebuild path without changing the public safe-export defaults for to_input_dataframe() or to_input_dict().

Testing

Add focused regression coverage with a synthetic formula-backed person_id so the test fails under the safe default export and passes when subsampling uses the full internal export.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions