idmtools.utils.file_parser module#

File parser utility. Used to automatically load data.

Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.

class idmtools.utils.file_parser.FileParser[source]#

Bases: object

FileParser to load contents in analysis.

classmethod parse(filename, content=None)[source]#

Parse filename and load the content.

Parameters:
  • filename – Filename to load

  • content – Content to load

Returns:

Content loaded

classmethod load_json_file(filename, content) Dict[source]#

Load JSON File.

Parameters:
  • filename – Filename to load

  • content – Content

Returns:

JSOn as dict

classmethod load_raw_file(filename, content)[source]#

Load content raw.

Parameters:
  • filename – Filename is none

  • content – Content to load

Returns:

Content as it was

classmethod load_csv_file(filename, content) DataFrame[source]#

Load csv file.

Parameters:
  • filename – Filename to load

  • content – Content is loading

Returns:

Loaded csv file

classmethod load_xlsx_file(filename, content) Dict[str, ExcelFile][source]#

Load excel_file.

Parameters:
  • filename – Filename to load

  • content – Content to load

Returns:

Loaded excel file

classmethod load_txt_file(filename, content)[source]#

Load text file.

Parameters:
  • filename – Filename to load

  • content – Content to load

Returns:

Content

classmethod load_bin_file(filename, content)[source]#

Load a bin file.

Parameters:
  • filename – Filename to load

  • content – Content to load

Returns:

Loaded bin file

Notes

We should move this to a plugin in emodpy. We need to figure out how to structure that.