Formatters — sdx-common 0.7.1 documentation

# 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`

  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)

    Generate the name of a PCK file.

  static `pck_batch_header`(batch_nr, ts)

    Generate a batch header for a PCK file.

  static `pck_form_header`(form_id, ru_ref, ru_check, period)

    Generate a form header for PCK data.

  static `pck_value`(qid, val, survey_id=None)

    Format a value as PCK data.

  static `pck_item`(q, a)

    Return a PCK line item.

  static `pck_lines`(data, batch_nr, ts, survey_id, inst_id, ru_ref, ru_check, period, **kwargs)

    Return a list of lines in a PCK file.

  static `write_pck`(f_obj, data, **kwargs)

    Write a PCK file.

  static `idbr_name`(user_ts, seq_nr, **kwargs)

    Generate the name of an IDBR file.

  static `idbr_receipt`(survey_id, ru_ref, ru_check, period, **kwargs)

    Format a receipt in IDBR format.

  static `write_idbr`(f_obj, **kwargs)

    Write an IDBR file.