Closed operdeck closed 2 months ago
Right I can see how this would work. We call 'struct.field', if the column is not a struct at all, do you think we should just leave it as null? It doesn't look like it has anything to do with is_available
I would expect the same return value (empty dataframe with a schema) regardless the value of "extract_keys". But if that costs some code complexity we can also just return None. The caller can easily check.
Tiny bit of complexity added - I'm simply doing a little pre-check to pull the very first row of the name column, and checking if the length of the df is >0. If not, I just return the original dataframe. Since extracting keys is eager anyway, this seems reasonable.
pdstools version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pdstools.
Issue description
When passing an empty dataframe to ADMDatamart and setting extract_keys to True, the initialiser fails with an ugly polars exception.
Passing an empty dataframe can happen when filtering for certain date ranges like in some of the dashboarding applications. Extracting the treatments is standard and should probably default to True.
Reproducible example
Expected behavior
Expect to just continue and return False if asked for is_available.
Installed versions