funpack.schema

The funpack.schema package contains functions for retrieving UK BioBank showcase schema files which contain metadata describing all UKB data fields and encoding schemes.

funpack.schema.DOWNLOAD = True

Flag used to enable/disable schema file downloads.

funpack.schema.NEVER_DOWNLOAD = False

Global override which disables schema file downloads. If True, files are never downloaded. This flag takes precedence over the DOWNLOAD flag - it is intended to be used for testing purposes.

funpack.schema.codingFileUrl(coding: int) str[source]

Return a URL to download a file containing the data coding for the specified UKB encoding scheme.

funpack.schema.downloadFile(url: str, backupFile: str, loadFunc: Callable, download: bool = True) Any[source]

Download a file from url, loading it using loadFunc.

If the download fails, or if download is True, the file is loaded from a local backupFile instead.

funpack.schema.encodingUrl() str[source]

Return a URL to download a file containing UKB “Encoding dictionaries”. This file contains meta data about the encoding schemes used by all UKB categorical variables.

funpack.schema.fieldUrl() str[source]

Return a URL to download a file containing UKB “Data field properties”. This file contains meta data about all UKB data fields.

funpack.schema.loadEnodingDictionaries(download: bool = True) DataFrame[source]

Downloads and loads the UKB encoding dictionaries file, returning it as a pandas.DataFrame.

funpack.schema.loadFieldProperties(download: bool = True) DataFrame[source]

Downloads and loads the UKB data field properties file, returning it as a pandas.DataFrame.

funpack.schema.shouldDownload()[source]

Used by downloadFile(). Returns True if schema files should be downloaded, or ``False``if off-line copies should be used instead.