Add a multi-reference version of the existing one-to-one indicator comparison report - #7
Add a multi-reference version of the existing one-to-one indicator comparison report#7jingjtang wants to merge 2 commits into
Conversation
JavierMtzRdz
left a comment
There was a problem hiding this comment.
Thanks for this! It improves almost all sections. Since it doesn't conflict with anything, we can merge once you add some instructions on how to use this to the READMEs and address the suggestions and issues. Those marked as minor suggestions (most of my comments) are more open recommendations. Then, eventually, we could replace indicator_correlation.qmdwith this.
If you also include the processing that uses only the necessary parameter depending on the indicator source and handle edge cases with either one location or many candidates, I'm happy to replace indicator_correlation.qmd with this, but that is not necessary. We can leave the full replacement for later.
| geo_type: state | ||
| time_type: day | ||
| start_day: "2020-09-01" | ||
| end_day: "2023-03-01" |
There was a problem hiding this comment.
Minor suggestion: it is worth including an "extra_key" parameter to add extra key columns when creating the epi_df. This works as is, but it may be useful for indicators with age_group.
| stringr::str_squish(stringr::str_replace_all(x, "\n", " ")) | ||
| } | ||
|
|
||
| vertical_indicator_axis <- function(text_size = 10) { |
There was a problem hiding this comment.
Minor suggestion: Some of these functions seem to be used only once. In those cases, we apply the theme layers directly for easier debugging.
| ) | ||
| } | ||
|
|
||
| load_indicator <- function(source, indicator, csv = NULL) { |
There was a problem hiding this comment.
Praise: Thanks for this function. At some point, I may port it to all other notebooks.
| options(repos = c( | ||
| delphi = "https://cmu-delphi.r-universe.dev", | ||
| CRAN = "https://cloud.r-project.org" | ||
| )) |
There was a problem hiding this comment.
suggestion: refer to the actual repos of the supporting packages to make sure they are up to date.
| options(repos = c( | |
| delphi = "https://cmu-delphi.r-universe.dev", | |
| CRAN = "https://cloud.r-project.org" | |
| )) | |
| if (!require("pak")) install.packages("pak") | |
| if (!requireNamespace("epiprocess", quietly = TRUE)) pak::pkg_install("cmu-delphi/epiprocess") | |
| if (!requireNamespace("epidatr", quietly = TRUE)) pak::pkg_install("cmu-delphi/epidatr") |
| candidate_source: doctor-visits | ||
| candidate_indicator: smoothed_adj_cli | ||
| candidate_name: "Doctor Visits: Smoothed Adj CLI" | ||
| candidate_csv: !expr "NULL" | ||
| # Reference Indicators | ||
| reference_sources: !expr 'c("quidel", "hospital-admissions", "chng", "chng")' | ||
| reference_indicators: !expr 'c("covid_ag_smoothed_pct_positive", "smoothed_covid19_from_claims", "7dav_inpatient_covid", "7dav_outpatient_covid")' | ||
| reference_names: !expr 'c("Quidel: Smoothed % Positive COVID Antigen", "Hospital Admissions: Smoothed COVID-19 from Claims", "CHNG: 7-day Avg Inpatient COVID", "CHNG: 7-day Avg Outpatient COVID")' |
There was a problem hiding this comment.
suggestion: I'm inclined to leave these parameters empty to ensure the user provides all the information required for the indicator they are interested in. However, the required indicators vary depending on whether the user is calling an indicator from the V5 API, the new API, or providing a CSV file. The last version of the correlation notebook has some of this.
|
|
||
| Main pairwise metrics. References are not combined. | ||
|
|
||
| ```{r} |
There was a problem hiding this comment.
This appears empty in the rendered version.
| This section summarizes values and missingness by location. Pair missingness is the fraction of periods where either value is missing. | ||
|
|
||
| ```{r} | ||
| #| label: eda-summary-missingness |
There was a problem hiding this comment.
issue: Most epidata indicators do not return NA when there is no data for a location or time. Instead, they omit the row. Therefore, summarizing missingness involves mapping all relevant time points and locations that could potentially contain each candidate. For example, the plot above shows some locations with temporal gaps.
| overlap_metric = factor(overlap_metric, levels = c("Rows loaded", "Locations loaded", "Overlap rows", "Overlap locations", "Overlap dates", "Overlap percent")) | ||
| ) | ||
|
|
||
| p_overlap <- ggplot(overlap_long, aes(x = overlap_metric, y = reference_label)) + |
There was a problem hiding this comment.
question: Is there a reason to prefer a plot over a table for this information?
There was a problem hiding this comment.
I'm aiming to keep the rendered files separate from the notebooks and code. Alternatively, you could include the rendering codes in the script/{post/pre}_render.R scripts to generate the output and then add it to the gh branch.
There was a problem hiding this comment.
Thanks for this. It looks great!
|
I've also added you to the repo, so there's no need to create forks. |
The new report evaluates one candidate indicator against multiple reference indicators in a single render. Each diagnostic remains pairwise.
Preview
Rendered HTML preview
Main Changes
indicator_comparison.qmdfor:Validation
Rendered successfully with: