Repository navigation
Commit b93aefc
authored
fix(timeseries): epoch and mixed-offset timestamps, MAD zero-scale, stable anomaly columns, cdc tz (#360)
Time-series streaming parsed the timestamp column with a bare
pd.to_datetime(errors="coerce"). Integer epoch seconds were read as
nanoseconds (1970), unparseable strings silently became NaT, and a batch
with mixed UTC offsets (a DST change) raised ValueError.
- #227: numeric timestamp and event-time columns are read as epochs. The
unit comes from the new TimeSeriesCleanConfig.timestamp_unit
("s"/"ms"/"us"/"ns"), or is inferred from the median magnitude
(<1e11 s, <1e14 ms, <1e17 us, else ns); a "timeseries_timestamp_parse"
action records the unit. Values that still fail to parse keep their row
and are recorded in report.coerced_cells / coerced_rows (masked for
sensitive_columns) with a medium-risk action and a report warning.
- #250: string parsing goes through coerce_datetimes(). When the plain
parse raises, returns an object column, or loses values, it retries with
utc=True and, on pandas >= 2 (which infers one format from the first
value), with format="ISO8601", keeping the attempt that loses the fewest
values. Clean batches still pay for a single parse, and a single-offset
or naive batch keeps its zone.
- #290: anomaly_window_size=1 is rejected in the config ("must be 0 or
>= 2") instead of failing inside pandas on the first batch.
- #291: MAD treated a zero MAD as a flat window, so the minority value of
any sparse or two-valued series was flagged and, with cap, overwritten
by the median. A window is now flat only when every other point in it
is identical. A zero MAD in a non-flat window gives no scale, so the
point is not flagged and its fences are NaN. A spike in a truly flat
window is still flagged and capped.
- #248 part b: anomaly target columns are chosen from the (locked)
numeric role, not from the batch dtype, so a numeric column holding a
stray string still emits <col>_anomaly. It is scored with
pd.to_numeric(errors="coerce"): non-numeric cells are neither flagged
nor capped. Interpolation and seasonal imputation still require a
numeric dtype.
- #233 part 4: cdc_profile parses event times with the same
coerce_datetimes() helper, so mixed offsets no longer crash cummax. The
default now is the current UTC time instead of local wall-clock time
for naive events. now= and watermark= are converted to the event
times' zone, reading naive values (and naive events) as UTC.
Closes #227
Closes #250
Closes #290
Closes #291
Refs #248 (part b: time-series anomaly columns)
Refs #233 (part 4: cdc_profile)1 parent 59eb326 commit b93aefc
4 files changed
Lines changed: 462 additions & 27 deletions
File tree
- src/freshdata
- streaming
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
159 | 184 | | |
160 | 185 | | |
161 | 186 | | |
| |||
214 | 239 | | |
215 | 240 | | |
216 | 241 | | |
217 | | - | |
| 242 | + | |
| 243 | + | |
218 | 244 | | |
219 | 245 | | |
220 | 246 | | |
| |||
274 | 300 | | |
275 | 301 | | |
276 | 302 | | |
| 303 | + | |
| 304 | + | |
277 | 305 | | |
278 | 306 | | |
279 | 307 | | |
| |||
292 | 320 | | |
293 | 321 | | |
294 | 322 | | |
295 | | - | |
296 | 323 | | |
297 | | - | |
298 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
299 | 327 | | |
300 | 328 | | |
301 | 329 | | |
| |||
315 | 343 | | |
316 | 344 | | |
317 | 345 | | |
318 | | - | |
| 346 | + | |
319 | 347 | | |
320 | 348 | | |
321 | 349 | | |
| |||
0 commit comments