ThomUK / SPCreporter

Creates Metric Reports using Statistical Process Control in the NHS style
https://thomuk.github.io/SPCreporter/
Other
6 stars 2 forks source link

Error when generating last date and last data point #75

Closed francisbarton closed 11 months ago

francisbarton commented 11 months ago

This error currently occurs on the main branch when the report config "expects" to find data in the measure data list that is not under a 'week' or 'month' table:

Warning messages:
1: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `last_date = max(measure_data[[1]][["date"]], na.rm =
  TRUE)`.
Caused by warning in `max.default()`:
! no non-missing arguments to max; returning -Inf 

The code that generates this data is in spcr_make_data_bundle here.

But the error is originally caused by data in a "none" aggregation being supplied in the original measure data, and expected by the report config, but then being filtered out by check_measure_data which only keeps week and month tables.

An associated question is what to stipulate that the sheet for any "time between"/"events between" rare event data should be labelled. We also need to decide if this can be submitted in long format, or whether it must be in wide format like week and month data.

Then we can include this sheet in the list of allowed data sheet names.

My preference on this would be either to follow the pattern of labelling by aggregation level, and since the event data is not aggregated then it should be called "none"; alternatively you could say that it is at the event level, and just be called "event". I actually prefer the latter I think.

I will submit a fix for this in the 75_correct_main_fb branch.