One approach could be that users change the formula e.g., add y ~ s(workplace), and then we parse out the new stratification term and then manage all the data manipulation etc.
It might simpler perhaps though to add something a stratification argument and then the user passes the bare variable name (bare name, as this indicates that this is part of the data).
e.g.,
fit_single_contact_model(
contact_data,
population,
symmetrical = TRUE,
# this is the new argument
stratification = workplace_name,
school_demographics = NULL,
work_demographics = NULL
)
And the populate the stratification argument across the relevant parts of the package code