Skip to content

Conversation

PhilippSchmelter
Copy link
Contributor

@PhilippSchmelter PhilippSchmelter commented Sep 29, 2025

This pull request refactors the CSV data handling infrastructure to introduce a shared, extensible file-based connector layer. It generalizes the file connector logic, introduces new metadata classes to support multiple file types, and removes legacy CSV-specific meta information classes. These changes improve code modularity and future extensibility for additional file formats.

File connector infrastructure refactoring:

  • Added new abstract base class FileConnector to encapsulate common file-based source/sink logic, including input stream handling and file path resolution. (src/main/java/edu/ie3/datamodel/io/connectors/FileConnector.java)
  • Refactored CsvFileConnector to extend FileConnector, removing redundant code and centralizing file handling logic. (src/main/java/edu/ie3/datamodel/io/connectors/CsvFileConnector.java) [1] [2] [3] [4]

File type and metadata generalization:

  • Introduced the FileType enum to represent supported file types (currently only CSV), with utility methods for file type detection. (src/main/java/edu/ie3/datamodel/io/file/FileType.java)
  • Added new metadata classes FileIndividualTimeSeriesMetaInformation and FileLoadProfileMetaInformation to replace CSV-specific meta information classes and support file type extensibility. (src/main/java/edu/ie3/datamodel/io/naming/timeseries/FileIndividualTimeSeriesMetaInformation.java, src/main/java/edu/ie3/datamodel/io/naming/timeseries/FileLoadProfileMetaInformation.java) [1] [2]

Cleanup and migration to new metadata:

  • Removed legacy CsvIndividualTimeSeriesMetaInformation and CsvLoadProfileMetaInformation classes, updating usages throughout the codebase to use the new file-based metadata classes. (src/main/java/edu/ie3/datamodel/io/csv/CsvIndividualTimeSeriesMetaInformation.java, src/main/java/edu/ie3/datamodel/io/csv/CsvLoadProfileMetaInformation.java, other affected files) [1] [2] [3] [4]

Documentation and changelog:

  • Updated CHANGELOG.md to document the refactoring of CSV handling into a shared file-based infrastructure. (CHANGELOG.md)

Package and import adjustments:

  • Migrated TimeSeriesMetaInformation and related classes to the io.naming.timeseries package, updating imports across affected files. (src/main/java/edu/ie3/datamodel/io/naming/TimeSeriesMetaInformation.javasrc/main/java/edu/ie3/datamodel/io/naming/timeseries/TimeSeriesMetaInformation.java) [1] [2] [3] [4] [5]

These changes lay the groundwork for supporting additional file formats beyond CSV, improving maintainability and extensibility.

Closes #1445

@PhilippSchmelter PhilippSchmelter self-assigned this Sep 29, 2025
@PhilippSchmelter PhilippSchmelter added the enhancement New feature or request label Sep 29, 2025
@PhilippSchmelter PhilippSchmelter marked this pull request as ready for review October 6, 2025 15:07
Copy link
Member

@staudtMarius staudtMarius left a comment

Choose a reason for hiding this comment

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

LGTM. I have just two small remarks.

- Change spotless to use googleJavaFormat('1.28.0') [#1409](https://github.com/ie3-institute/PowerSystemDataModel/issues/1409)
- Change `TimeSeries` to no longer extend `UniqueEntity` [#1441](https://github.com/ie3-institute/PowerSystemDataModel/issues/1441)

- Refactor CSV handling into shared file-based infrastructure. [#1450](https://github.com/ie3-institute/PowerSystemDataModel/issues/1445)
Copy link
Member

Choose a reason for hiding this comment

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

Could you add an empty line below?

}
}

def "The CSV time series meta information source returns correct meta information for a given time series UUID"() {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a check for the file type here?

@sebastian-peter
Copy link
Member

I'll also have a second look at this as soon as I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generalize CSV -> File in PSDM
3 participants