USACE / cwms-data-api

Corps Water Management System RESTful Data Service
MIT License
13 stars 14 forks source link

Need Data Entry Date for Time Series Data #634

Open inguyen314 opened 6 months ago

inguyen314 commented 6 months ago

I have a report that extracts forecast time series for the next three days along with the forecast date (data_entry_date)

I need the "data_entry_date" for all values when using the TimeSeries API.

SQL Example

select cwms_util.change_timezone(date_time, 'UTC', 'CST6CDT') as date_time
    ,value
    ,cwms_ts_id
    ,cwms_util.split_text(cwms_ts_id, 1, '.') as location_id
    ,unit_id
    ,to_char(cwms_util.change_timezone(data_entry_date, 'UTC', 'CST6CDT'), 'mm/dd HH24:MI') as data_entry_date
from CWMS_20.AV_TSV_DQU
where cwms_ts_id = 'St Charles-Missouri.Stage.Inst.6Hours.0.RVFShef-FF'
    and unit_id = 'ft'
    and date_time = to_date('05-07-2024 ' || '12:00' ,'mm-dd-yyyy hh24:mi');

right now, CDA returns this now.
Current Data:

{
"values": [
    [
      1715018400000,
      25.3,
      0
    ],
    [
      1715040000000,
      25.199999999999996,
      0
    ],
    [
      1715061600000,
      25.1,
      0
    ]
  ]
}

I would like it to include the data entry date along side. Although I am not sure if this is the best way to go about it, but just as an example:

New Data: Proposed payload:


{
"values": [
    [
      1715018400000,
      25.3,
      0,
     **data_entry_date**
    ],
    [
      1715040000000,
      25.199999999999996,
      0,
     **data_entry_date**
    ],
    [
      1715061600000,
      25.1,
      0,
     **data_entry_date**
    ]
  ]
}
MikeNeilson commented 6 months ago

Probably best to make it optional, 90% (made up number) of usages don't really care, but when you need it there's not going to be another way than through this end point.

rma-rripken commented 5 months ago

Is there a need for a TsvDqu (or something similar) end-point that returned raw arrays of values?