Repository navigation
feat: dcc_ date consistency comparison suite - #33
Conversation
…nconsistent. Added dcc inconsistent which returns a table of inconsistent records
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| if(!all(required_columns %in% names(data.EIR))) { | ||
| stop("Error: data.EIR should contain the following columns: ID, date_birth, date_vax, ADM1_residence, ADM2_residence, ADM1_occurrence, ADM2_occurrence, dose.") | ||
| } | ||
| if(!is.null(indicator) && indicator == "dcc"){ |
There was a problem hiding this comment.
Could be nicer to make the print be built automatically from the vector of expected columns. Especially now that we might define different required columns for each module.
| @@ -0,0 +1,55 @@ | |||
| #' (D)ate (C)onsistency (C)omparison Rate | |||
| #' | |||
| #' This function calculates the consistency comparison rate between two date variables, further disagreggating by geographic level, using data from the electronic immunization registry (EIR). | |||
There was a problem hiding this comment.
I think "consistency comparison rate" sounds a little weird? Maybe just "consistency rate"?
There was a problem hiding this comment.
Clarifying: The dcc name seems fine to me. But in the docs when you say "This function calculates the consistency comparison rate...", maybe it would be best to say "This function calculates the rate of consistency between two date variables, further disaggregating..."
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
||
| # Glossary | ||
|
|
||
| ## Political Geographic Boundaries |
There was a problem hiding this comment.
For discussion: the other vignettes used a slightly expanded version of this section. Should we normalize to match the other vignettes? (i.e. copy-paste)
|
|
||
| #### Interpretation | ||
|
|
||
| The x-axis shows the absolute number of days between the two dates, regardless of direction (i.e., whether `date_1` precedes `date_2` or vice versa). Records concentrated in the first bins (0–9 days) are likely simple data entry errors, while records in the 100+ category may indicate systematic record linkage problems. |
There was a problem hiding this comment.
Records with 100+ days could also be typos. For example, if someone types "2022-02-25" instead of "2022-12-25".
I would expand this explanation to: "The horizontal axis shows the number of days between inconsistent dates. An investigation into the most common causes for the inconsistencies in each bin should be performed. For example, records with large differences can be caused by typos during data entry (e.g. when a date is written as 2022-02-25 instead of 2022-12-25. But, they can also point to more serious systematic problems."
| @@ -0,0 +1,34 @@ | |||
| #' (D)ate (C)onsistency (C)omparison Inconsistent Registriest | |||
There was a problem hiding this comment.
Typo: Regisitries. Also, would call it "Inconsistent Records" instead of "Registries"
| @@ -0,0 +1,34 @@ | |||
| #' (D)ate (C)onsistency (C)omparison Inconsistent Registriest | |||
| #' | |||
| #' This function lists the inconsistent records between two date variables, further disagreggating by geographic level, using data from the electronic immunization registry (EIR). | |||
There was a problem hiding this comment.
Would improve docs to match what was written in the vignette: "This function returns a record-level table of all inconsistent and "date missing" entries, including the day difference between the two dates."
There was a problem hiding this comment.
Lets keep the changelog in the gh releases for now. Not in a file within the repo
|
|
||
| ## Date Consistency Comparison Analysis | ||
|
|
||
| ### Expected Workflow |
There was a problem hiding this comment.
Missing the "expected workflow" block diagram we have in the other vignettes. Can be put after the bullets and just say "The figure below shows the expected workflow".
|
Aside from the comments I alread put in, the rest LGTM. Will have to update README to include this new module, but that can be done in develop without the need for a PR. |
- Auto-build validation error message from required_columns vector - Fix dcc_rate description wording - Fix dcc_inconsistent title typo and improve description - Expand vignette glossary to match other vignettes - Add expected workflow diagram reference to vignette - Update inconsistent_plot interpretation text - Remove CHANGELOG.md (use GH releases instead) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Channeling my stackoverflow admin energy: Missing .svg for dcc_workflow but I'll let it slide for now. Must be added before next release. LGTM. Merged. |
Summary
dcc_functions for comparing chronological consistency between two date variables in the EIRCHANGELOG.mdfollowing the Keep a Changelog formatChanges
Added
dcc_rate()— consistency rates (CONSISTENT / INCONSISTENT / DATE_MISSING) disaggregated by ADM0/ADM1/ADM2dcc_barplot()— stacked bar chart of rates;date_1_name/date_2_nameparams for subtitledcc_inconsistent()— record-level table of inconsistent and missing entries with day differencedcc_inconsistent_plot()— histogram of absolute day differences; customizable bins viaday_groupslist ofc(lower, upper)pairs, default 10-day bins 0–100 with 100+ catch-allvignettes/date_consistency_comparison_en.Rmd— full workflow vignetteCHANGELOG.md— Keep a Changelog formatTest plan
dcc_rate()returns correct counts and rates for all three consistency categoriesdcc_rate()geo_level ADM0 / ADM1 / ADM2 all produce expected groupingsdcc_barplot()renders correctly; subtitle reflectsdate_1_name/date_2_name;plot_missing = FALSEexcludes grey segmentdcc_inconsistent()returns only INCONSISTENT and DATE_MISSING rows;diffcolumn sign is correctdcc_inconsistent_plot()default bins render; customday_groupsoverride renders correctly🤖 Generated with Claude Code