Rare-Technology / FMA_Dashboard

Fisheries Management Assessment Tool
https://portal.rare.org/en/tools-and-data/fma/
MIT License
0 stars 1 forks source link

Should raw data table be filtered by date and min records per species #21

Closed zross closed 3 years ago

zross commented 3 years ago

In #6 you mention:

The input$DataSlider should only appear when the length base indicators are selected and only affect the selected data for that indicator

This is fine, but does it affect the data being shown on the Data tab? So basically I'm confirming:

  1. Does data on the Data tab get filtered by the selected date range?
  2. Does data on the Data tab get filtered by min records slider?
abelvaldivia commented 3 years ago
  1. Yes.
  2. Yes. However, the min record slider is only meant to affect the length base indicators (size structure, and size proportion)
zross commented 3 years ago

I'm not clear on what you mean by "is only meant to affect the length base indicators". If the user filters based on min record, then the Data table is filtered and this affects all the plots. This is how it works with the current application and the re-write. How do you want it to work?

abelvaldivia commented 3 years ago

This is correct. but now that I am thinking more about this, let's make it simpler for the user and remove the min records data slider completely. We can add a hard filter on the data that is use to draw Size Proportion. So for the plot_size_proportion.R function, could you add another filter to achieve at least 100 counts per species per month. This is the minimum number of counts required to say something meaningful about this indicator.

zross commented 3 years ago

OK. Here is what I did (you can click on the commit directly above to see this):

  1. Comment out the minimum records filter slider
  2. Added an additional filter statement

But questions:

  1. You ask for "at least 100 counts per species per month". Did I do the filter correctly? Is count associated with yearmonth? I'm not seeing any aggregation in the plot_size_proportions function by month.
  2. Does this apply to the size structure plot also? Any others?
abelvaldivia commented 3 years ago

@zross great! may answers to the last two points:

1) Correct, the filter should select only those species that have at least 100 records per month. So yes, we need include an aggregation in the plot_size_proportions function. The filter may look something like this...

.data <- .data %>% dplyr::filter(species %in% sel_species) %>% dplyr::filter(!is.na(count)) %>% dplyr::group_by(year month) %>% dplyr::filter(sum(count) >= 100)) %>% droplevels()

2) Correct, the filter also applies to the size structure plot.