Ribbit-Network / ribbit-network-dashboard

The web dashboard for the world's largest crowdsourced network of open-source, low-cost, CO2 Gas Detection Sensors.
MIT License
17 stars 16 forks source link

Check type after db query for get_map_data() #51

Closed spestana closed 2 years ago

spestana commented 2 years ago

This is addressing issue #50.

When the query to the db returns more than one table, these are returned as a list of pd.DataFrames, which were then concatenated with pd.concat(df). However, sometimes the db only returns a single table (possibly when only one sensor on the network has posted new observations?) and pd.concat() fails when given a single pd.DataFrame rather than a list.

I've added a type hint to the get_map_data() function, and only concatenate if we indeed have a list.

keenanjohnson commented 2 years ago

Looks good and thanks for the quick turnaround!

keenanjohnson commented 2 years ago

@all-contributors please add @spestana for his help fixing bugs in the code :)

allcontributors[bot] commented 2 years ago

@keenanjohnson

I've put up a pull request to add @spestana! :tada: