Skip to content

Commit

Permalink
Add flowchart for ccodwg-update.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanpaulrsoucy committed Jan 9, 2022
1 parent 8d125e0 commit 195c219
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
47 changes: 47 additions & 0 deletions docs/flowcharts/flowchart-ccodwg-update.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# load packages
library(DiagrammeR)
library(DiagrammeRsvg)
library(rsvg)
library(png)

# define flowchart
flowchart_ccodwg_update <- grViz('digraph flowchart {
graph [layout = dot, fontsize = 20, label = "\nBlue boxes indicate an automated step. Red boxes indicate a manual step."]
# node definitions and labels
node [fontname = Helvetica, shape = rectangle, penwidth = 4]
data_computer [color = grey, label = "Machine-readable data"]
data_manual [color = grey, label = "Non-machine-readable data"]
etl [color = blue, label = <Automated data downloading and <br/>processing via <i>Covid19CanadaETL</i>>]
manual_entry [color = red, label = "Manual data entry"]
google_sheets [color = grey, label = "Data spreadsheets\n(Google Sheets)"]
verify_manual_data [color = blue, label = <Verify manual data have been entered<br/><i>(verify_manual_data.R)</i>>]
verify_data_sources [color = blue, label = <Periodic automated verification<br/>for missing/erroneous data<br/><i>(verify_data_sources.R)</i>>]
manual_correction [color = red, label = "Review automated notifications and\nmanually correct data (if necessary)"]
prepare_update [color = blue, label = <Prepare data update<br/><i>(update_data.R)</i>>]
update_summary [color = blue, label = <Automated summary of update<br/><i>(update_data_validation_funs.R)</i>>]
prepare_update_official [color = blue, label = <Add official datasets to data update<br/><i>(update_official_data.R)</i>>]
update_github [color = blue, label = "Push data update to GitHub (22:00 ET)"]
update_gdrive [color = blue, label = "Sync updated data files to Google Drive"]
# edge definitions with the node IDs
data_computer -> etl -> google_sheets
data_manual -> manual_entry -> google_sheets
manual_entry -> verify_manual_data
google_sheets -> verify_data_sources -> manual_correction
google_sheets -> prepare_update -> update_summary -> manual_correction
prepare_update_official -> prepare_update -> update_github -> update_gdrive
}')

# function to export plot as png
# https://stackoverflow.com/a/65919537
save_png <- function(plot, path) {
DiagrammeRsvg::export_svg(plot) %>%
charToRaw() %>%
rsvg::rsvg() %>%
png::writePNG(path)
}

# export flowchart
save_png(flowchart_ccodwg_update, "flowchart_ccodwg_update.png")
Binary file added docs/flowcharts/flowchart_ccodwg_update.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions docs/flowcharts/flowcharts.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

0 comments on commit 195c219

Please sign in to comment.