Skip to content

Create function to validate input data in the optimize.py script#30

Open
Max4375 wants to merge 13 commits into
mainfrom
validate_input_data_type
Open

Create function to validate input data in the optimize.py script#30
Max4375 wants to merge 13 commits into
mainfrom
validate_input_data_type

Conversation

@Max4375

@Max4375 Max4375 commented Mar 16, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

…nge github workflow from Black and Flake8 to Ruff
@monika-o

Copy link
Copy Markdown
Collaborator

Thank you for the input validation function. Is is working and I like how it checks whether profiles actually exists and prints useful error messages. Here are some points I see that could be improved:

  1. Empty fields are also valid input data in many cases and should not produce errors. For simplicity, I would permit empty fields in every column.
  2. The column names in the profile sheet may change and should not be hardcoded. Instead of checking the type for every single column, I would check whether all values in the sheet are floats (or empty cells), except for the column names and the index.
  3. Generally, the list could be shortened in my view by aggregating similar columns. E.g. all values of columns with a name starting with "bus_" should be strings, all values for column names starting with "eff_" should be floats.
  4. There is no field in the input data that must contain a number of type float and not int. The column_specks look somewhat random in the allocation of int and float. A solution to make this more coherent could be to convert all ints to floats before checking the type. I am open for other solutions.
  5. The sheet "general" is structured row-wise, not column-wise. Therefore the fields in the "value" column have different types and should be checked one by one.

@Max4375 Max4375 changed the title Create function to validate input data in the optimize.py script, change github workflow from Black and Flake8 to Ruff Create function to validate input data in the optimize.py script May 4, 2026
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