Skip to content
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

Allow retrieval of constant value location levels over a date range #599

Open
DanielTOsborne opened this issue Mar 29, 2024 · 1 comment · May be fixed by #887
Open

Allow retrieval of constant value location levels over a date range #599

DanielTOsborne opened this issue Mar 29, 2024 · 1 comment · May be fixed by #887
Assignees
Labels
approved-W192HQ23F0232-task4 Only valid if set by MikeNeilson, DanielO, CharlesG priority:high

Comments

@DanielTOsborne
Copy link
Collaborator

DanielTOsborne commented Mar 29, 2024

For non-timeseries location levels, I'd like to specify a date range and see all the values it was set to within that date range.

For example...
Assuming the levels table contains these:

LOCATION_LEVEL_ID				LEVEL_DATE	LEVEL_UNIT	CONSTANT_LEVEL
Lake Isabella.Stor.Inst.0.Top of Gross Pool	01-JAN-00	ac-ft		568100.0
Lake Isabella.Stor.Inst.0.Top of Gross Pool	01-OCT-10	ac-ft		361249.99999999994
Lake Isabella.Stor.Inst.0.Top of Gross Pool	13-JUN-23	ac-ft		568100.0

Notice the LEVEL_DATE is different.

I'd like to supply a start and end date, and get a result like this:

{
  "office-id": "SPK",
  "location-level-id": "Lake Isabella.Stor.Inst.0.Top of Gross Pool",
  "seasonal-values": [],
  "constant-value": 568100,
  "constant-values": [
    ["1900-01-01T00:00:00-07:00", 568100],
    ["2010-10-01T00:00:00-07:00", 361249.99999999994],
    ["2024-06-13T00:00:00-07:00", 568100],
  ],
  "level-date-start": "1900-01-01T00:00:00-07:00",
  "level-date-end": "2024-06-13T00:00:00-07:00",
  "level-units-id": "ac-ft",
  "level-date": "2024-06-13T00:00:00-07:00",
  "interval-months": 0,
  "interval-minutes": 0,
  "attribute-units-id": "ac-ft"
}

For the regular single point-in-time query, I'd expect "constant-values" array to be empty, if present at all. At least if compatibility with the current version is desired. If not, making the entire thing an array even for a single result is fine with me.
For compatibility, I left the current behavior in there as well, where it returns "constant-value" and "level-date", which is set to the most recent value in the date range requested. That can be changed if desired too.

I'm open to various output formats, I listed the above as an example.
Personally, I'd prefer the unix epoch timestamp, like in timeseries, but this levels call already has its own date format. Though, the response doesn't include the timezone, so it's not round-trippable. That's a separate issue though.

@MikeNeilson MikeNeilson added the approved-W192HQ23F0232-task4 Only valid if set by MikeNeilson, DanielO, CharlesG label Mar 29, 2024
@zack-rma zack-rma self-assigned this Sep 27, 2024
zack-rma added a commit to zack-rma/cwms-data-api that referenced this issue Sep 28, 2024
…t values. Includes tests to verify functionality
@MikeNeilson MikeNeilson moved this to In Progress in CWMS/Data Feature Tracking Sep 30, 2024
@adamkorynta
Copy link
Collaborator

The getAll endpoint already accomplishes this. You can pass in the level id and a start and end date. It will create a record with each effective date along with its value. It would be up to the client to ignore seasonal/timeseries levels. I could see an update that restructures the LocationLevels DTO to group all levels with the same id to remove redundant data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved-W192HQ23F0232-task4 Only valid if set by MikeNeilson, DanielO, CharlesG priority:high
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

4 participants