oasislmf.preparation.reinsurance_layer¶
Attributes¶
Functions¶
|
Create new profile id from reinsurance in ri_df corresponding to reins_type. |
|
|
|
Build the cross-reference dataframe, which serves as a representation |
|
Create the Oasis structures - FM Programmes, FM Profiles and FM Policy |
Module Contents¶
- oasislmf.preparation.reinsurance_layer.XREF_COLUMN_DEFAULT = ['PortNumber', 'AccNumber', 'PolNumber', 'LocNumber'][source]¶
- oasislmf.preparation.reinsurance_layer.RISK_LEVEL_ALL_FIELDS = ['PortNumber', 'AccNumber', 'PolNumber', 'LocGroup', 'LocNumber'][source]¶
- oasislmf.preparation.reinsurance_layer.FILTER_LEVEL_EXTRA_FIELDS = ['CedantName', 'ProducerName', 'LOB', 'CountryCode', 'ReinsTag'][source]¶
- oasislmf.preparation.reinsurance_layer.create_risk_level_profile_id(ri_df, profile_map_df, fm_profile_df, reins_type, risk_level, fm_level_id, logger)[source]¶
Create new profile id from reinsurance in ri_df corresponding to reins_type. Add them to fm_profile_df and match the profile_ids in ri_df and profile_map_df
- Parameters:
ri_df – ri info and scope
profile_map_df – tree structure df representing each ri fm levels
fm_profile_df – df containing all the profiles
reins_type – type of reinsurance (one of oed.REINS_TYPES)
risk_level – level of the reinsurance terms (one of oed.REINS_RISK_LEVELS)
fm_level_id – fm level in profile_map_df
logger – logger the assigned profile ids are dumped to at debug level
- Returns:
updated version of fm_profile_df
- Return type:
fm_profile_df
- oasislmf.preparation.reinsurance_layer.get_xref_df(xref_descriptions_df, risk_level)[source]¶
Build the cross-reference dataframe, which serves as a representation of the insurance programme depending on the reinsurance risk level. Dataframes for programme, risk, filter and items levels are created. The fields agg_id, level_id and to_agg_id (agg_id_to), which are used to construct the FM Programmes structure, are assigned. The aforementioned dataframes are concatenated to form a single dataframe called xref_df, which is returned. The returned dataframe features the fields necessary for the assignment of profile IDs.
- Parameters:
xref_descriptions_df – Fm summary mapping enhanced by relevant information from Loc and Account
risk_level – risk_level
- Returns:
- dict of one dataframe per fm level, keyed in level order by
’programme_level’, ‘risk_level’, ‘filter_level’ and ‘items_level’. Each dataframe carries the agg_id, level_id and agg_id_to fields used to build the FM Programmes structure. Insertion order matters: the caller concatenates the values into the single xref_df.
- Return type:
df_levels
- oasislmf.preparation.reinsurance_layer.write_files_for_reinsurance(ri_info_df, ri_scope_df, xref_descriptions_df, output_dir, fm_xref_fp, intermediary_csv, logger)[source]¶
Create the Oasis structures - FM Programmes, FM Profiles and FM Policy TCs - that represent the reinsurance structure.
The cross-reference dataframe, which serves as a representation of the insurance programme depending on the reinsurance risk level, is built. Except facultative contracts, each contract is a separate layer. Profile IDs for the risk and filter levels are created using the merged reinsurance scope and info dataframes. These profile IDs are assigned according to some combination of the fields PortNumber, AccNumber, PolNumber, LocGroup and LocNumber, dependent on reinsurance risk level. Individual programme level profile IDs are assigned for each row of the reinsurance info dataframe. Finally, the Oasis structure is written out.
- Parameters:
ri_info_df (pandas.DataFrame) – reinsurance info, one row per contract
ri_scope_df (pandas.DataFrame) – reinsurance scope, joined to ri_info_df on ReinsNumber
xref_descriptions_df (pandas.DataFrame) – Fm summary mapping enhanced by relevant information from Loc and Account
output_dir (str) – directory the per-layer RI_<n> sub-directories are written into
fm_xref_fp (str) – path to the direct insurance fm_xref binary the RI xref is built from
intermediary_csv (bool) – If True, also write a csv copy of each Oasis structure alongside the binary
logger (logging.Logger) – logger the dataframes are dumped to at debug level
- Returns:
- one entry per written layer, keyed by a 1-based reinsurance index, holding the
inuring_priority, risk_level and output directory of that layer
- Return type: