oasislmf.preparation.il_inputs

Module Contents

Functions

get_grouped_fm_profile_by_level_and_term_group([...])

Get the grouped exposure + accounts profile - this describes the

get_grouped_fm_terms_by_level_and_term_group([...])

Get the FM terms profile (this is a simplfied view of the main grouped

get_oed_hierarchy([exposure_profile, accounts_profile])

get_calc_rule_ids(il_inputs_calc_rules_df, calc_rule_type)

merge selected il_inputs with the correct calc_rule table and return a pandas Series of calc. rule IDs

get_profile_ids(il_inputs_df)

Returns a Numpy array of policy TC IDs from a table of IL input items

get_step_profile_ids(il_inputs_df[, offset, idx_cols])

Returns a Numpy array of policy TC IDs from a table of IL input items that

get_il_input_items(gul_inputs_df, locations_df, ...[, ...])

Generates and returns a Pandas dataframe of IL input items.

write_fm_policytc_file(il_inputs_df, fm_policytc_fp[, ...])

Writes an FM policy T & C file.

write_fm_profile_file(il_inputs_df, fm_profile_fp[, ...])

Writes an FM profile file.

write_fm_programme_file(il_inputs_df, fm_programme_fp)

Writes an FM programme file.

write_fm_xref_file(il_inputs_df, fm_xref_fp[, chunksize])

Writes an FM xref file.

write_il_input_files(il_inputs_df, target_dir[, ...])

Writes standard Oasis IL input files to a target directory using a

oasislmf.preparation.il_inputs.get_calc_rule_ids(il_inputs_calc_rules_df, calc_rule_type)[source]

merge selected il_inputs with the correct calc_rule table and return a pandas Series of calc. rule IDs

Args:

il_inputs_calc_rules_df (DataFrame): IL input items dataframe calc_rule_type (str): type of calc_rule to look for

Returns:

pandas Series of calc. rule IDs

oasislmf.preparation.il_inputs.get_profile_ids(il_inputs_df)[source]

Returns a Numpy array of policy TC IDs from a table of IL input items

Parameters:

il_inputs_df (pandas.DataFrame) – IL input items dataframe

Returns:

Numpy array of policy TC IDs

Return type:

numpy.ndarray

oasislmf.preparation.il_inputs.get_step_profile_ids(il_inputs_df, offset=0, idx_cols=[])[source]

Returns a Numpy array of policy TC IDs from a table of IL input items that include step policies

Parameters:
  • il_inputs_df (pandas.DataFrame) – IL input items dataframe

  • step_trigger_type_cols – column names used to determine values for

terms indicators and types :type step_trigger_type_cols: list

Returns:

Numpy array of policy TC IDs

Return type:

numpy.ndarray

oasislmf.preparation.il_inputs.get_il_input_items(gul_inputs_df, locations_df, accounts_df, oed_schema, exposure_profile=get_default_exposure_profile(), accounts_profile=get_default_accounts_profile(), fm_aggregation_profile=get_default_fm_aggregation_profile(), do_disaggregation=True)[source]

Generates and returns a Pandas dataframe of IL input items.

Parameters:
  • locations_df (pandas.DataFrame) – Source exposure

  • gul_inputs_df (pandas.DataFrame) – GUL input items

  • accounts_df – Source accounts dataframe (optional)

  • accounts_df – pandas.DataFrame

  • accounts_fp – Source accounts file path (optional)

  • accounts_fp – str

  • exposure_profile (dict) – Source exposure profile (optional)

  • accounts_profile (dict) – Source accounts profile (optional)

  • fm_aggregation_profile – FM aggregation profile (optional)

  • fm_aggregation_profile – dict

  • do_disaggregation – whether to split terms and conditions for aggregate exposure (optional)

  • do_disaggregation – bool

Returns:

IL inputs dataframe

Return type:

pandas.DataFrame

:return Accounts dataframe :rtype: pandas.DataFrame

oasislmf.preparation.il_inputs.write_fm_policytc_file(il_inputs_df, fm_policytc_fp, chunksize=100000)[source]

Writes an FM policy T & C file.

Parameters:
  • il_inputs_df (pandas.DataFrame) – IL inputs dataframe

  • fm_policytc_fp (str) – FM policy TC file path

Returns:

FM policy TC file path

Return type:

str

oasislmf.preparation.il_inputs.write_fm_profile_file(il_inputs_df, fm_profile_fp, chunksize=100000)[source]

Writes an FM profile file.

Parameters:
  • il_inputs_df (pandas.DataFrame) – IL inputs dataframe

  • fm_profile_fp (str) – FM profile file path

Returns:

FM profile file path

Return type:

str

oasislmf.preparation.il_inputs.write_fm_programme_file(il_inputs_df, fm_programme_fp, chunksize=100000)[source]

Writes an FM programme file.

Parameters:
  • il_inputs_df (pandas.DataFrame) – IL inputs dataframe

  • fm_programme_fp (str) – FM programme file path

Returns:

FM programme file path

Return type:

str

oasislmf.preparation.il_inputs.write_fm_xref_file(il_inputs_df, fm_xref_fp, chunksize=100000)[source]

Writes an FM xref file.

Parameters:
  • il_inputs_df (pandas.DataFrame) – IL inputs dataframe

  • fm_xref_fp (str) – FM xref file path

Returns:

FM xref file path

Return type:

str

oasislmf.preparation.il_inputs.write_il_input_files(il_inputs_df, target_dir, oasis_files_prefixes=OASIS_FILES_PREFIXES['il'], chunksize=2 * 10**5)[source]

Writes standard Oasis IL input files to a target directory using a pre-generated dataframe of IL inputs dataframe. The files written are

fm_policytc.csv
fm_profile.csv
fm_programme.csv
fm_xref.csv
Parameters:
  • il_inputs_df – IL inputs dataframe

  • target_dir (str) – Target directory in which to write the files

  • oasis_files_prefixes – Oasis IL input file name prefixes

  • oasis_files_prefixes – dict

  • chunksize (int) – The chunk size to use when writing out the input files

Returns:

IL input files dict

Return type:

dict