Skip to content

Conversation

@sebastian-peter
Copy link
Member

@sebastian-peter sebastian-peter commented Jan 28, 2022

Resolves #513

Additions:

  • SqlConnector.SqlIndividualTimeSeriesMetaInformation analogous to CsvFileConnector.CsvIndividualTimeSeriesMetaInformation

Adapted:

  • SqlTimeSeriesMappingSource
  • Tests

Refactorings:

  • Moved from edu.ie3.datamodel.io.csv to edu.ie3.datamodel.io.naming: FileNameMetaInformation (renamed to DataSourceMetaInformation)
  • Moved from edu.ie3.datamodel.io.csv.timeseries to edu.ie3.datamodel.io.naming.timeseries: IndividualTimeSeriesMetaInformation, LoadProfileTimeSeriesMetaInformation, ColumnScheme
  • (if you think there's a better place, let me know)

@sebastian-peter sebastian-peter force-pushed the sp/#513-SqlIndividualTimeSeriesMetaInformation branch from bb5d671 to 4963ad2 Compare January 28, 2022 17:17
@sebastian-peter sebastian-peter force-pushed the sp/#513-SqlIndividualTimeSeriesMetaInformation branch from 4963ad2 to b6b6600 Compare January 28, 2022 17:19
@sonarqubegithubprchecks

This comment has been minimized.

@sonarqubegithubprchecks

This comment has been minimized.

@sonarqubegithubprchecks

This comment has been minimized.

@sonarqubegithubprchecks

This comment has been minimized.

@codecov
Copy link

codecov bot commented Jan 28, 2022

Codecov Report

Merging #518 (48ef593) into dev (eec2bc6) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##                dev     #518   +/-   ##
=========================================
  Coverage     78.94%   78.95%           
+ Complexity     2131     2127    -4     
=========================================
  Files           265      265           
  Lines          8356     8371   +15     
  Branches        785      788    +3     
=========================================
+ Hits           6597     6609   +12     
- Misses         1356     1362    +6     
+ Partials        403      400    -3     
Impacted Files Coverage Δ
...atamodel/models/input/system/type/BmTypeInput.java 73.68% <0.00%> (-5.27%) ⬇️
.../ie3/datamodel/io/connectors/CsvFileConnector.java 77.77% <0.00%> (-0.14%) ⬇️
...du/ie3/datamodel/io/naming/FileNamingStrategy.java 92.85% <0.00%> (ø)
...atamodel/models/input/system/type/EvTypeInput.java 73.68% <0.00%> (ø)
...tamodel/models/input/system/type/WecTypeInput.java 69.23% <0.00%> (ø)
...odel/io/source/sql/SqlTimeSeriesMappingSource.java 100.00% <0.00%> (ø)
...del/io/naming/EntityPersistenceNamingStrategy.java 94.11% <0.00%> (ø)
...del/models/input/system/type/StorageTypeInput.java 69.44% <0.00%> (ø)
...imeseries/IndividualTimeSeriesMetaInformation.java
.../ie3/datamodel/io/csv/timeseries/ColumnScheme.java
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9fee752...48ef593. Read the comment docs.

@sebastian-peter sebastian-peter requested a review from a team January 28, 2022 22:52
@sonarqubegithubprchecks

This comment has been minimized.

@sonarqubegithubprchecks

This comment has been minimized.

@sebastian-peter sebastian-peter self-assigned this Feb 1, 2022
@sonarqubegithubprchecks

This comment has been minimized.

@sonarqubegithubprchecks

This comment has been minimized.

@sebastian-peter sebastian-peter requested a review from a team February 2, 2022 12:51
Copy link
Member

@ckittl ckittl left a comment

Choose a reason for hiding this comment

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

Generally looks good! Thanks a lot! I only would like you to improve the structure, that I introduced back then... 🙈

/** Meta information, that can be derived from a certain file name */
public abstract class FileNameMetaInformation {
/** Meta information, that can be derived from a data source */
public abstract class DataSourceMetaInformation {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not fully convinced with the name... Yes, it does describe a data source, but it does not describe a data source in general. It's more describing a time series data source. But TimeSeriesDataSourceMetaInformation is a bit long. Do you have any other suggestion?

Copy link
Member Author

Choose a reason for hiding this comment

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

In that case, how about simply TimeSeriesMetaInformation?

Copy link
Member Author

Choose a reason for hiding this comment

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


/** Specific meta information, that can be derived from a individual time series file */
public class IndividualTimeSeriesMetaInformation extends FileNameMetaInformation {
public class IndividualTimeSeriesMetaInformation extends DataSourceMetaInformation {
Copy link
Member

Choose a reason for hiding this comment

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

I know, it's not your fault (I introduced this flaw), but I'm not super happy with the fact, that this is not an abstract class. It would be better, if you could only instantiate SqlIndividualTimeSeriesMetaInformation and CsvIndividualTimeSeriesInformation.

One opportunity, I would like you to check out, is to check, if EntityPersistenceNamingStrategy#extractIndividualTimesSeriesMetaInformation couldn't be moved to both of the implementing classes as static method parse(String, ...). Parts of the logic of the method could obviously be moved here and then the individual time series pattern doesn't have to be publicly accessible.

What do you think?

Copy link
Member Author

@sebastian-peter sebastian-peter Feb 2, 2022

Choose a reason for hiding this comment

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

To the second part: A counter-argument would be here, that multiple EntityPersistenceNamingStrategy can exist and thus allow for different naming strategies of files/tables. When integrating the function into the timeseries meta information, only one single naming strategy could exist.

Copy link
Member Author

Choose a reason for hiding this comment

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

To the first point: IndividualTimeSeriesMetaInformation is currently instantiated in EntityPersistenceNamingStrategy#extractIndividualTimesSeriesMetaInformation and I think it makes some sense that way. If we want to make the class abstract, we have to think of another solution there.


/** Specific meta information, that can be derived from a load profile time series file */
public class LoadProfileTimeSeriesMetaInformation extends FileNameMetaInformation {
public class LoadProfileTimeSeriesMetaInformation extends DataSourceMetaInformation {
Copy link
Member

Choose a reason for hiding this comment

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

Same applies as for InvdividualTimeSeriesMetaInformation. ^^

* Enhancing the {@link IndividualTimeSeriesMetaInformation} with the name of the table containing
* the time series
*/
public static class SqlIndividualTimeSeriesMetaInformation
Copy link
Member

Choose a reason for hiding this comment

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

The class nearly has the same outline as CsvIndividualTimeSeriesMetaInformation. Maybe we could also merge both classes? Instead of tableName and fullFilePath something like location?

Copy link
Member Author

Choose a reason for hiding this comment

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

I like your suggestion, however I also like having a distinction between csv and sql meta information

sqlMetaInf.tableName == tableName
}

def "SqlIndividualTimeSeriesMetaInformation returns a proper String representation"() {
Copy link
Member

Choose a reason for hiding this comment

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

Well, I guess we don't need such kind of a test, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Without it, test coverage is too low

@johanneshiry johanneshiry added the code quality Code readability or structure is improved label Feb 2, 2022
@johanneshiry johanneshiry added this to the Version 2.2 milestone Feb 2, 2022
@johanneshiry johanneshiry self-requested a review February 2, 2022 14:14
Co-authored-by: Chris Kittl <44838605+ckittl@users.noreply.github.com>
@sonarqubegithubprchecks
Copy link

Passed

Analysis Details

0 Issues

  • Bug0 Bugs
  • Vulnerability0 Vulnerabilities
  • Code Smell0 Code Smells

Coverage and Duplications

  • 60 percent coverage76.56% Coverage (78.00% Estimated after merge)
  • 3 percent duplication0.00% Duplicated Code (0.20% Estimated after merge)

Project ID: edu.ie3:PowerSystemDataModel

View in SonarQube

@sebastian-peter sebastian-peter marked this pull request as draft February 2, 2022 22:39
@sebastian-peter
Copy link
Member Author

This is now continued in #524. Please do not delete the branch here yet.

@sebastian-peter sebastian-peter deleted the sp/#513-SqlIndividualTimeSeriesMetaInformation branch February 23, 2022 12:29
@sebastian-peter sebastian-peter modified the milestones: Version 2.2, Version 3.0 Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality Code readability or structure is improved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce SqlIndividualTimeSeriesMetaInformation

5 participants