socrata / discuss

Discuss all the things!
https://dev.socrata.com
Apache License 2.0
10 stars 3 forks source link

checkboxes - true, false, or null #36

Open kevinsmgov opened 7 years ago

kevinsmgov commented 7 years ago

We recently ran into an issue where we were getting errors on filtered views that include checkboxes in their filter (in this case, that the columns were not checked). The underlying dataset is private and the filtered views are public.

The dataset is populated by an ETL process that uses our SODA.NET library and the checkbox columns are defined as boolean properties. Our process was setting the boolean properties to true or false. everything appeared to be working correctly until we tested anonymous access to the filtered views via the API - the service returned status 500 errors.

Socrata support investigated it for some time and determined that the filtered view API call could not deal with the checkbox columns containing false values. Instead, the checkbox columns needed to contain true or null.

We recoded our ETL to specifically set the boolean properties to true or null and our filtered view API calls now work correctly. However, this raises a question about the API, or its documentation:

https://dev.socrata.com/docs/datatypes/checkbox.html#,

Either the API service should be updated to support false values as well as null or the documentation should reflect that only true or null values are allowed

chrismetcalf commented 7 years ago

I tracked this one through our CS and Engineering teams to see what was going on.

A fix for the bug that you encountered with your public filtered view on your private dataset containing a checkbox column with false values (wow, that was a mouthful) has been checked in and will be making it out to production once our next release candidate completes testing. So once that's out, you shouldn't encounter that bug anymore.

I also did some testing, and for normal datasets, they behave properly for all three states - true, false, and null - that a Checkbox column can have. In this case, it was the filtered view behaving improperly, rather than an issue with the underlying dataset API.

Although I know in this case there was a particular reason you chose to use a public filtered view on a private dataset, I always encourage publishers to use public datasets and public APIs as much as possible. In addition to introducing additional links in the chain like the one that caused you to encounter that bug, the public-view-on-private-dataset configuration also prevents you from making use of all the SODA 2.1 endpoints available to public datasets, which provide a ton of additional query functionality and also improved performance: https://dev.socrata.com/docs/endpoints.html#version-21-latest