Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paed parameters that need to be extracted #51

Open
mwalte10 opened this issue Jul 27, 2023 · 3 comments
Open

Paed parameters that need to be extracted #51

mwalte10 opened this issue Jul 27, 2023 · 3 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@mwalte10
Copy link
Collaborator

mwalte10 commented Jul 27, 2023

@mwalte10 mwalte10 added the help wanted Extra attention is needed label Jul 27, 2023
@mwalte10
Copy link
Collaborator Author

Whether cotrim was input as a percentage or a number should be added here.

leapfrog/R/read-spectrum.R

Lines 292 to 324 in b579d26

dp_read_childart <- function(dp) {
dp <- get_dp_data(dp)
dpy <- get_dp_years(dp)
indicator_names <- c("childart_ctx",
"childart_art0to14",
"childart_art0to4",
"childart_art5to9",
"childart_art10to14")
if (exists_dptag(dp, "<ChildTreatInputs MV3>")) {
childart <- dpsub(dp, "<ChildTreatInputs MV3>", 2:6, dpy$time_data_idx)
} else {
stop("Child ART input tag not recognized. Function probably needs update for this .DP file.")
}
childart <- sapply(childart, as.numeric)
dimnames(childart) <- list(indicator = indicator_names, year = dpy$proj_years)
childart[childart == -9999] <- NA_real_
if (exists_dptag(dp, "<ChildARTByAgeGroupPerNum MV2>")) {
childart_ispercent <- dpsub(dp, "<ChildARTByAgeGroupPerNum MV2>", 2:6, dpy$time_data_idx)
} else {
stop("Child ART input tag not recognized. Function probably needs update for this .DP file.")
}
childart_ispercent <- sapply(childart_ispercent, as.logical)
dimnames(childart_ispercent) <- list(indicator = indicator_names, year = dpy$proj_years)
list(childart = childart,
childart_ispercent = childart_ispercent)
}

@jeffeaton

@jeffeaton
Copy link
Collaborator

Whether cotrim was input as a percentage or a number should be added here.

leapfrog/R/read-spectrum.R

Lines 292 to 324 in b579d26

dp_read_childart <- function(dp) {
dp <- get_dp_data(dp)
dpy <- get_dp_years(dp)
indicator_names <- c("childart_ctx",
"childart_art0to14",
"childart_art0to4",
"childart_art5to9",
"childart_art10to14")
if (exists_dptag(dp, "<ChildTreatInputs MV3>")) {
childart <- dpsub(dp, "<ChildTreatInputs MV3>", 2:6, dpy$time_data_idx)
} else {
stop("Child ART input tag not recognized. Function probably needs update for this .DP file.")
}
childart <- sapply(childart, as.numeric)
dimnames(childart) <- list(indicator = indicator_names, year = dpy$proj_years)
childart[childart == -9999] <- NA_real_
if (exists_dptag(dp, "<ChildARTByAgeGroupPerNum MV2>")) {
childart_ispercent <- dpsub(dp, "<ChildARTByAgeGroupPerNum MV2>", 2:6, dpy$time_data_idx)
} else {
stop("Child ART input tag not recognized. Function probably needs update for this .DP file.")
}
childart_ispercent <- sapply(childart_ispercent, as.logical)
dimnames(childart_ispercent) <- list(indicator = indicator_names, year = dpy$proj_years)
list(childart = childart,
childart_ispercent = childart_ispercent)
}

@jeffeaton

Thanks very much. This function returns a list of two tables, where the first table val$childart is the values entered for cotrim and child ART by age, and the second table val$childart_ispercent has the same dimension and reflects whether each number is a number or percent.

I think that the cotrim as a percentage is the first row of the output of the second table. However, there was an error in the code and it was mostly returning NA values. That is fixed in PR #54.

Can you please merge that and check if the percentage flag makes sense now, or still looks funny?

@jeffeaton
Copy link
Collaborator

@mwalte10 -- what is status on this issue now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants