-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Summary
Capture the type of variable expected for each column mapping in meta, and then somehow enforce those types in the app. For example, id_col should always be character, and labs$measure_col should always be numeric.
Details
Version 1 of the app had a complicated system for data checks that were almost definitely overkill and has been removed in version 2. This can definitely lead to problems and confusion when loading dirty data (and broken charts) though (as @JimBuchanan and @xni7 noted in recent conversations). Capturing the expected type for columns is easy enough, but deciding what to do with that information in the app is more complex.
A few options:
- We could only show columns with the required type in the mapping section dropdowns (e.g. the id_col dropdown would only show character (and factor??) variables)
- Show all variables in mapping dropdowns, but then coerce variables to the required type before drawing charts. (e.g. if a numeric column is selected for id_col, but it's coerced to character)
- Show a warning in the mapping section if a variable isn't the correct type.
- Leave the app as is, but implement checks in the initialization process.
Certainly open to other suggestion, but I'd lean towards option 3 above since it would be pretty easy to implement.
Two final notes:
- In an ideal world, the charts would deal with this kind of check. If a non-numeric value is provided for a numeric column, the chart should throw an error. This happens sometimes in our htmlwidgets, but it's generally in the error logs and not visible to the user.
- There actually is a type variable in meta that specifies whether the mapping is
fieldorcolumnlevel. I think we'd want to rename the existing variable if we implement this.