Skip to content

Commit

Permalink
Provide overview at top of page1 as per meeting.
Browse files Browse the repository at this point in the history
  Make title case consistent in headers.
  • Loading branch information
grosscol committed May 19, 2020
1 parent a184f1e commit a1ca8cc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
19 changes: 12 additions & 7 deletions main.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ line_plot <- function(maptg_data, measure_id){
theme(legend.position="bottom", legend.box.spacing = unit(0,"mm"))
}

numerator_sum <- function(maptg_data, measure_id, recipient){
m14_sum <- maptg_data %>%
filter(measure == measure_id, ascribee == recipient) %>%
pull(numerator) %>%
sum()
}

######################
# Process Input Data #
######################
Expand All @@ -213,12 +220,11 @@ INCLUDE_CID <- FALSE
# Generate Report Content #
###########################

#### SUM: Women Delievered
m14_sum <- maptg_data %>%
filter(measure == "M14", ascribee == RECIP) %>%
pull(numerator) %>%
sum()

#### SUMS: OVERVIEW
m14_sum <- numerator_sum(maptg_data, "M14", RECIP)
m5_sum <- numerator_sum(maptg_data, "M5", RECIP)
m1_sum <- numerator_sum(maptg_data, "M1", RECIP)

#### FIGURE
plot_data <- maptg_data %>%
filter(measure =="M14", ascribee == RECIP) %>%
Expand Down Expand Up @@ -376,7 +382,6 @@ figE8F578 <- ggplot(plot_data, aes(x=short_name)) +
legend.key.size = unit(4, "mm") ) +
#guides(color=guide_legend(override.aes=list(fill="Provided"))) +
ylab("Number of Women")
figE8F578

content_id <- deparse(substitute(figE8F578))
infoE8F578 <- paste(content_id, "m16,17,18")
Expand Down
20 changes: 12 additions & 8 deletions report.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,19 @@ if(INCLUDE_CID){ cat('\\includeCIDtrue') }else{ cat('\\includeCIDfalse') }
\begin{minipage}[t][0.28\textheight][t]{0.5\textwidth}
% Add strut to top of minipage to provide alignment baseline
\strut\vspace*{-\baselineskip}\newline

% content
\parbox{\textwidth}{
\centering
\vspace{10mm}
\textbf{\Huge \Sexpr{m14_sum}}\par
\vspace{2mm}
{\small Women in aged 15 -- 44 who had a live birth}\par
{\tiny Measure 14}\par
Overview for Women Aged 15-44 Who Delivered\\\par
\vspace{4mm}
\textbf{\Large \Sexpr{m14_sum}}\par
Had a live birth\\
\vspace{3mm}
\textbf{\Large \Sexpr{m5_sum}}\par
Received Counseling\\
\vspace{3mm}
\textbf{\Large \Sexpr{m1_sum}}\par
Received Immmediate Contraception\\
}
% lower filler
\vfill
Expand Down Expand Up @@ -229,7 +233,7 @@ if(INCLUDE_CID){ cat('\\includeCIDtrue') }else{ cat('\\includeCIDfalse') }
\parbox{\textwidth}{ {\tiny \Sexpr{infoBDBC81}} \par }
\fi
\centering
Women who had a live birth and recieve their preferred contraceptive\\
Women Who had a Live Birth and Recieved Their Preferred Contraceptive\\
\vspace{2mm}
<< dbg1, include=TRUE, fig.show='hold', fig.width=2.5, fig.height=2.5, dev='pdf' >>=
figBDBC81
Expand All @@ -242,7 +246,7 @@ if(INCLUDE_CID){ cat('\\includeCIDtrue') }else{ cat('\\includeCIDfalse') }
\ifincludeCID
\parbox{\textwidth}{ {\tiny \Sexpr{infoE8F578}} \par }
\fi
Proportion of contraception preferred and provided\\
Proportion of Contraception Preferred and Provided\\
\centering
<< dbg2, include=TRUE, fig.show='hold', fig.width=4, fig.height=2.8, dev='pdf' >>=
figE8F578
Expand Down

0 comments on commit a1ca8cc

Please sign in to comment.