UofS-Pulse-Binfo / analyzedphenotypes

Tripal/Drupal support for analyzed phenotypic data including data loaders, exporters, trait pages and summaries on germplasm pages.
GNU General Public License v2.0
0 stars 1 forks source link

Decouple Chart type from unit type #102

Closed laceysanderson closed 4 years ago

laceysanderson commented 5 years ago

Currently the chart type (i.e. violin vs. histogram) is controlled by whether the unit is qualitative or quantitative. For example, the data for stem pigmentation measured with a scale 1-3 (qualitative) will show as a histogram and the same trait measured with a greenseeker (quantitative) will show as a violin.

However, there are other cases where you may prefer one chart type over another. For example, if there is only a single site-year (histogram) or the data is clearly bimodal (Violin). Thus we need a way to decouple the chart type from the unit.

laceysanderson commented 5 years ago

The Plan

The chart type needs to be specific to the trait-method-unit-experiment combination and the only place these are combined are for each phenotypic data point. Since it would be a bad idea to add a chart type property to every phenotypic data point (disagreements, data size, etc.) and since chart type is a UI property versus a data property, I will create a Drupal table to store the chart type for each combination.

Trait Method Unit Experiment Chart Type
Stem Pigmentation visually scaled scale 1-3 AGILE histogram
Stem Pigmentation greenseeker NDVI Exploratory histogram
Stem Pigmentation greenseeker NDVI Large-scale project violin

This will need:

  1. Implement hook_schema to create the table
  2. Implement update hook to populate table for pre-existing data
  3. Add to importer rules for default when data is loaded
  4. Adjust chart js to choose type based off this table rather then qualitative/quantitative