funpack.main
This module contains the funpack
entry point.
- funpack.main.configLogging(args)[source]
Configures
funpack
logging.- Parameters:
args –
argparse.Namespace
object containing parsed command line arguments.
- funpack.main.doCleanAndProcess(dtable, args)[source]
Data cleaning and processing stage.
- Parameters:
dtable –
DataTable
containing the dataargs –
argparse.Namespace
object containing command line argumentspool –
multiprocessing.Pool
object for parallelisation (may beNone
)
- funpack.main.doDescriptionExport(dtable, args)[source]
If a
--description_file
has been specified, a description for every column is saved out to the file.
- funpack.main.doExport(dtable, args)[source]
Data export stage.
- Parameters:
dtable –
DataTable
containing the dataargs –
argparse.Namespace
object containing command line arguments
- funpack.main.doICD10Export(args)[source]
If a
--icd10_map_file
has been specified, the ICD10 codes present in the data (and their converted values) are saved out to the file.
- funpack.main.doImport(args, mgr)[source]
Data import stage.
- Parameters:
args –
argparse.Namespace
object containing command line argumentsmgr –
multiprocessing.Manager
object for parallelisation (may beNone
)
- Returns:
A tuple containing:
- funpack.main.doSummaryExport(dtable, args)[source]
If a
--summary_file
has been specified, a summary of the cleaning steps that have been applied to each variable are saved out to the file.
- funpack.main.doUnknownsExport(dtable, args, unknowns, uncategorised)[source]
If the
--unknown_vars_file
argument was used, the unknown/ unprocessed columns are saved out to a file.- Parameters:
dtable –
DataTable
containing the dataargs –
argparse.Namespace
object containing command line argumentsunknowns – List of
Column
objects representing the unknown columns.uncategorised – A sequence of
Column
objects representing columns which are uncategorised, and have no processing or cleaning rules specified on them.
- funpack.main.generateDescription(dtable, col)[source]
Called by
doDescriptionExport()
. Generates and returns a suitable description for the given column.- Parameters:
dtable –
Datatable
instancecol –
Column
instance
- funpack.main.splitDataTable(dtable, args)[source]
Splits the .:class:DataTable into separate numeric/non-numeric tables.
Called by
doExport()
. If the--suppress_non_numerics
and/or--write_non_numerics
options are active, non-numeric columns need to be separated from numeric columns, and possibly saved to a separate output file.