oasislmf.lookup.base

Module Contents

Classes

AbstractBasicKeyLookup

Basic abstract class for KeyLookup

MultiprocLookupMixin

Simple mixin class for multiprocessing

OasisBaseLookup

Abstract class that help with the implementation of the KeyServerInterface.

class oasislmf.lookup.base.AbstractBasicKeyLookup(config, config_dir=None, user_data_dir=None, output_dir=None)[source]

Basic abstract class for KeyLookup

interface_version = '1'[source]
abstract process_locations(locations)[source]

Process location rows - passed in as a pandas dataframe. Results can be list, tuple, generator or a pandas dataframe.

class oasislmf.lookup.base.MultiprocLookupMixin[source]

Simple mixin class for multiprocessing

implement the process_locations_multiproc by transforming the result of process_locations into a pandas DataFrame

process_locations_multiproc(loc_df_part)[source]
class oasislmf.lookup.base.OasisBaseLookup(config=None, config_json=None, config_fp=None, config_dir=None, user_data_dir=None, output_dir=None)[source]

Bases: AbstractBasicKeyLookup, MultiprocLookupMixin

Abstract class that help with the implementation of the KeyServerInterface. require lookup method to be implemented. Lookup will be call to create a key for each peril id and coverage type

property config[source]
multiproc_enabled = True[source]
abstract lookup(loc, peril_id, coverage_type, **kwargs)[source]

Lookup for an individual location item, which could be a dict or a Pandas series object.

process_locations(locs)[source]

Bulk vulnerability lookup for a list, tuple, generator, pandas data frame or dict of location items, which can be dicts or Pandas series objects or any object which has as a dict-like interface.

Generates results using yield.