Skip to content

Normalise node type names#38

Open
knoxsp wants to merge 1 commit intomasterfrom
allow_more_flexibility_in_template_node_type_names
Open

Normalise node type names#38
knoxsp wants to merge 1 commit intomasterfrom
allow_more_flexibility_in_template_node_type_names

Conversation

@knoxsp
Copy link
Collaborator

@knoxsp knoxsp commented Sep 26, 2024

Remove non-alpha characters from node type names coming from the template, and make them lower caase, allowing for the template to display more user-friendly names, while maintaining compatibility in pywr

template, and make them lower caase, allowing for the template to
display more user-friendly names, while maintaining compatibility in
pywr
@pmslavin
Copy link
Collaborator

It is quite common in existing models to use numbers in node names, especially at the end to distinguish nodes within some kind of group, e.g. "Generator 1", "Generator 2", "Abstraction T1", etc. The re.sub would collapse all such names down to just the same alphabetic characters.

Is there a case for enforcing "variable name" convention instead, where digits can be present in a node name anywhere except as the initial character and underscores used to allow "spacing" between parts of a name?

@knoxsp
Copy link
Collaborator Author

knoxsp commented Feb 24, 2025

I think the proper solution for this is a hydra solution where template type names have a 'code' and a 'label' where the code must not have spaces, and can only contain a specific set of characters such as alphanumeric characters and - and _, and maybe a select few others... -- something like: [a-zA-Z0-9-_]

This would require a new column (code?) on template type, populated by default with the normalised name of the 'name' column in the upgrade script.

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.

3 participants