hli module

Usage

from pycax import hli

# Download one record as a data frame
df = hli.getdf("NOSA", qargs={'limit': 1})
id = df['popid'][0]
# Download a data frame using a filter
filt = {'popid': id}
df = hli.getdf("NOSA", fargs=filt)

Methods:

pycax.hli.get(hli, tabletype='xport', qargs={}, fargs={}, **kwargs)[source]

Get a table using the table name from /ca/tables API: pycax.datasets.getdf()

Parameters:
  • hli – [String] A HLI short code: NOSA, SAR, PNI, JuvOut, PreSmolt, RperS

  • tabletype – [String] ‘base’ or ‘xport’; default is xport

  • qargs – [dict] a dictionary of query parameters. The default is no parameters. See usage for common query parameters

  • fargs – [dict] a dictionary of filter values as {colname1: value}, {colname1: [value1, value2]} or {colname1: value, colname2: value}. The default is no filter. See usage for examples.

Returns:

A dictionary of class HliResponse ready for execution

Usage:

from pycax import hli
query = hli.get('NOSA', 'base', qargs={'limit': 1})
query.execute()
query.data # get the data
query.api_url # get the API url
pycax.hli.getdf(hli, tabletype='xport', qargs={}, fargs={}, **kwargs)[source]

Get a HLI table and return a data frame sorted in the same order as the HLI Tabular Query

This uses the json file for the column names in in the data directory.

Parameters:
  • hli – [String] A HLI short code: NOSA, SAR, PNI, JuvOut, PreSmolt, RperS

  • tabletype – [String] ‘base’ or ‘xport’; default is xport

  • qargs – [dict] a dictionary of query parameters. The default is no parameters. See usage for common query parameters

  • fargs – [dict] a dictionary of filter values as {colname1: value}, {colname1: [value1, value2]} or {colname1: value, colname2: value}. The default is no filter. See usage for examples.

Returns:

A dictionary of class HliResponse ready for execution

Usage:

from pycax import hli
res = hli.getdf('NOSA', 'xport', fargs={'popid': 7})
res.head()
pycax.hli.return_tablename(hli, tabletype)[source]

Retrieve a table name for a hli short code for base or xport table type

Parameters:
  • hli – [String] A HLI short code: NOSA, SAR, PNI, JuvOut, PreSmolt, RperS

  • tabletype – [String] “base” or “xport”

Returns:

A table name as a string

Usage:

from pycax import hli
hli.tablename('NOSA', 'base')