packTool: Pack a requested tool

View source: R/packTool.R

packToolR Documentation

Pack a requested tool

Description

Generates a requested Data Pack or OPU Data Pack tool by taking an Excel template file and combining it with data pulled from DATIM API to produce a file ready for distribution.

Usage

packTool(
  model_data = NULL,
  model_data_path = NULL,
  snuxim_model_data_path = NULL,
  undistributed_mer_data = NULL,
  tool,
  datapack_name,
  country_uids,
  template_path,
  cop_year,
  season,
  output_folder,
  results_archive = TRUE,
  expand_formulas = FALSE,
  spectrum_data = NULL,
  d2_session = dynGet("d2_default_session", inherits = TRUE)
)

Arguments

model_data

Data from DATIM needed to pack into a COP Data Pack.

model_data_path

Local filepath to a Data Pack model data file.

snuxim_model_data_path

Local filepath to an SNUxIM Model Data file.

undistributed_mer_data

Data from the d$datim$UndistributedMER dataset that can be provided while generating an OPU tool such that the targets to be distributed will be sourced from this file.

tool

Type of tool this function will create or interact with. Either OPU Data Pack or Data Pack

datapack_name

Name you would like associated with this Data Pack. (Example: "Western Hemisphere", or "Caribbean Region", or "Kenya".)

country_uids

Unique IDs for countries to include in the Data Pack. For full list of these IDs, see datapackr::valid_OrgUnits.

template_path

Local filepath to Data Pack template Excel (XLSX) file. This file MUST NOT have any data validation formats present. If left NULL, will select the default based on cop_year and tool.

cop_year

COP Year to use for tailoring functions. Remember, FY22 targets = COP21.

season

Either COP or OPU.

output_folder

Local folder where you would like your Data Pack to be saved upon export.

results_archive

If TRUE, will export compiled results of all tests and processes to output_folder.

spectrum_data

Spectrum output, as a dataframe.

d2_session

DHIS2 Session id. R6 datimutils object which handles authentication with DATIM.

Value

Exports a Data Pack or OPU Data Pack tool to Excel within output_folder.


pepfar-datim/datapackr documentation built on April 14, 2024, 10:35 p.m.