Skip to content

Forecast file formats

Matthew Cornell edited this page Sep 23, 2019 · 1 revision

We support three file formats: Zoltar JSON, Zoltar CSV, and CDC CSV:

  • Zoltar JSON: Zoltar's native json format that is used for uploading to and downloading from the Zoltar API. Based on the https://github.com/cdcepi/predx format. Referred to as a "json_io_dict" in the code. Example: tests/predictions-example.json .
  • Zoltar CSV: CSV data format based on https://github.com/cdcepi/predx . Example: TODO .
  • CDC CSV: CDC format as documented elsewhere. Example: tests/EW1-KoTsarima-2017-01-17-small.csv .

To convert between them:

Zoltar JSON -> Zoltar CSV:

  • csv_rows_from_json_io_dict() returns a list of rows suitable for saving to a file
  • dataframe_from_json_io_dict() returns a pandas data frame

Zoltar JSON -> CDC CSV:

  • cdc_csv_rows_from_json_io_dict() returns a list of CDC CSV rows suitable for saving to a file

Zoltar CSV -> Zoltar JSON: currently unsupported

CDC CSV -> Zoltar JSON:

  • json_io_dict_from_cdc_csv_file() returns a Zoltar JSON dict from a CDC CSV file

NB: These need to be made more consistent re: whether they take/return a list of rows vs. a file.