Handle ObservationSummary dict is None#898
Conversation
A working/final observation_summary JSON whose content is the literal 'null' parses to None and was returned as-is, crashing every consumer (addObsParam, saveObservationSummaryDict, storeDictInDB). Treat a non-dict parse result like a corrupt file: back it up and reset. Also move the None guard in storeDictInDB above addRequiredColumns so it short-circuits before use, and fix two typos in the log messages. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@g7gpr Could you test this latest version with my modifications? |
|
Incoporated pr #910, from issue #739, with thanks to @markmac99 Retesting overnight on au0004,6,7 |
|
Tested and working on three stations. Ready for further review / merge. |
addRequiredColumns creates columns lower-cased, so existing_columns only ever holds lower-case names. The dict filter compared the original-case key, so mixed-case keys such as "stationID" were silently dropped and never inserted, leaving the stationid column NULL. Match case-insensitively and key the filtered dict by the lower-cased name. Also ungate the dropped-keys warning so real data loss is logged, not hidden behind the debug flag. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Reviewed this — one correctness regression worth flagging, which I've pushed a fix for (98c1eb8).
dict_filtered_by_columns = {k: v for k, v in d.items() if k in existing_columns}Columns are always created lower-cased ( Fix matches case-insensitively and keys the filtered dict by the lower-cased name: dict_filtered_by_columns = {k.lower(): v for k, v in d.items() if k.lower() in existing_columns}Verified in isolation: old filter drops Also ungated the dropped-keys Everything else checked out: the |
|
Agree with these changes, penultimate commit introduced an error, which latest commit has corrected. I'm testing on au0004,6,7; there should be enough night left to capture a small amount of data. |
|
All looks good now. |
Post-review nits (non-functional): - .config: use ';' comment prefix for time_server, matching file convention. - parseSystem: read time_server once instead of calling parser.get twice. - addRequiredColumns: return set() (not None) in the d-is-None branch, so the documented set contract holds even though the caller guards d is None first. - storeDictInDB docstring typo: pring -> print. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Avoid iterating over ObservationSummary dict when dict is None