-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time Series Profile Controllers #856
base: develop
Are you sure you want to change the base?
Time Series Profile Controllers #856
Conversation
Current TimeSeriesProfileInstanceDao Catalog implementation does not return parameter list for the TimeSeriesProfiles |
cwms-data-api/src/main/java/cwms/cda/formatters/json/JsonV1.java
Outdated
Show resolved
Hide resolved
After discussion with the team, a new data structure for the TSP Instances has been developed that should allow for paging implementation and improved consistency across endpoints that deal with time series data (gate changes, turbines, etc). Here's JSON of that new structure. @MikeNeilson Please take a look and let me know your thoughts.
|
Looks reasonable to me. Might be good to provide a total field in addition to the page and page-size, would let applications be able to properly render a progress bar. |
Thoughts on changing this to something like:
Unless key-parameter means something other than specifying the independent variable |
I believe it does. One of the parameters is used as basically a reference point for other operations. |
…rofile parser columnar data
...data-api/src/main/java/cwms/cda/data/dao/timeseriesprofile/TimeSeriesProfileInstanceDao.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added more feedback
...pi/src/main/java/cwms/cda/api/timeseriesprofile/TimeSeriesProfileParserCreateController.java
Outdated
Show resolved
Hide resolved
...a-api/src/main/java/cwms/cda/data/dto/timeseriesprofile/TimeSeriesProfileParserColumnar.java
Outdated
Show resolved
Hide resolved
...ta-api/src/main/java/cwms/cda/data/dto/timeseriesprofile/TimeSeriesProfileParserIndexed.java
Outdated
Show resolved
Hide resolved
...a-api/src/main/java/cwms/cda/formatters/json/adapters/TimeSeriesProfileParserSerializer.java
Outdated
Show resolved
Hide resolved
...-data-api/src/test/java/cwms/cda/data/dto/timeseriesprofile/TimeSeriesProfileParserTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments. The test imply the areas I'm asking already do what's asked for VERSION_DATE, but it wasn't super obvious when looking through the controllers themselves.
.getOrDefault(true); | ||
boolean previous = ctx.queryParamAsClass(PREVIOUS, boolean.class).getOrDefault(false); | ||
boolean next = ctx.queryParamAsClass(NEXT, boolean.class).getOrDefault(false); | ||
Instant versionDate = ctx.queryParamAsClass(VERSION_DATE, String.class).getOrDefault(null) == null | ||
? null : Instant.ofEpochMilli(Long.parseLong(ctx.queryParamAsClass(VERSION_DATE, String.class) | ||
.getOrDefault(null))); | ||
? null : Instant.parse(ctx.queryParamAsClass(VERSION_DATE, String.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this take the ISO8601 formats?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to take in ISO 8601 format
@@ -62,14 +68,14 @@ public TimeSeriesProfileInstanceCreateController(MetricRegistry metrics) { | |||
@OpenApiParam(name = OVERRIDE_PROTECTION, type = Boolean.class, description = "Override protection" | |||
+ " for the time series profile instance. Default is false"), | |||
@OpenApiParam(name = VERSION_DATE, type = Long.class, description = "The version date of the" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Time Series controller allows the ISO8601 formats, shouldn't we do that here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated documentation and added tests, now supports ISO 8601 entry
+ " time series profile instance. Default is UTC"), | ||
@OpenApiParam(name = TIMEZONE, description = "Specifies " | ||
+ "the time zone of the values of the begin and end fields. If this field is not specified, " | ||
+ "the default time zone of UTC shall be used."), | ||
@OpenApiParam(name = VERSION_DATE, type = Instant.class, description = "The version date of the" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as others. regarding version date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to support ISO8601
.getOrDefault(Instant.now().toEpochMilli())); | ||
Instant firstDate = Instant.ofEpochMilli(ctx.queryParamAsClass(DATE, Long.class) | ||
.getOrDefault(Instant.now().toEpochMilli())); | ||
Instant versionDate = requiredInstant(ctx, VERSION_DATE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VersionDate is Long in the OpenAPI annotation, but can be string here.
NOTE: I'm pretty sure this line is correct and this code should be used in the other controllers that process a version date as it centralizes the flexibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed annotation to Instant. Allows for string entry as a long or ISO 8601 format.
SelectHavingStep<Record1<Integer>> count = dsl.select(countDistinct(VIEW_TSV2.DATE_TIME)) | ||
.from(VIEW_TSV2) | ||
.where(finalWhereCondition); | ||
total = Objects.requireNonNull(count.fetchOne()).value1(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an odd use of requireNonNull, why aren't we throwing a more specific exception, or none at all if this condition is okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed usage, replaced with NullPointerException error handling
builder.withPageLastDate(timeList.stream().max(Instant::compareTo).orElse(null)); | ||
builder.withVersionDate(versionDate); | ||
return builder | ||
.build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No a huge deal but this doesn't need to be on a new line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to same line
…oller_adam update to latest schema version
Implementation of Time Series Profile Definition, Parser, and Instance controllers