Formatters

Downstream systems ingest transformed survey data in several formats.

Formatter classes are stateless namespaces for functions which convert survey data to those downstream formats.

class sdx.common.formats.cs_formatter.CSFormatter[source]

Formatter for common software systems.

Serialises standard data types to PCK format. Creates a receipt in IDBR format.

static pck_name(survey_id, seq_nr, **kwargs)[source]

Generate the name of a PCK file.

static pck_batch_header(batch_nr, ts)[source]

Generate a batch header for a PCK file.

static pck_form_header(form_id, ru_ref, ru_check, period)[source]

Generate a form header for PCK data.

static pck_value(qid, val, survey_id=None)[source]

Format a value as PCK data.

static pck_item(q, a)[source]

Return a PCK line item.

static pck_lines(data, batch_nr, ts, survey_id, inst_id, ru_ref, ru_check, period, **kwargs)[source]

Return a list of lines in a PCK file.

static write_pck(f_obj, data, **kwargs)[source]

Write a PCK file.

static idbr_name(user_ts, seq_nr, **kwargs)[source]

Generate the name of an IDBR file.

static idbr_receipt(survey_id, ru_ref, ru_check, period, **kwargs)[source]

Format a receipt in IDBR format.

static write_idbr(f_obj, **kwargs)[source]

Write an IDBR file.