oasislmf.platform_api.client

Classes

ApiEndpoint

Used to Implement the default requests common to all Oasis API

JsonEndpoint

Used for JSON data End points.

FileEndpoint

File Resources Endpoint for Upload / Downloading

API_models

Used to Implement the default requests common to all Oasis API

API_portfolios

Used to Implement the default requests common to all Oasis API

API_analyses

Used to Implement the default requests common to all Oasis API

APIClient

Module Contents

class oasislmf.platform_api.client.ApiEndpoint(session, url_endpoint, logger=None)[source]

Bases: object

Used to Implement the default requests common to all Oasis API End points.

logger[source]
session[source]
url_endpoint = ''[source]
create(data)[source]
get(ID=None)[source]
delete(ID)[source]
search(metadata={})[source]
class oasislmf.platform_api.client.JsonEndpoint(session, url_endpoint, url_resource, logger=None)[source]

Bases: object

Used for JSON data End points.

logger[source]
session[source]
url_endpoint = ''[source]
url_resource = ''[source]
get(ID)[source]
post(ID, data)[source]
delete(ID)[source]
download(ID, file_path, overwrite=True)[source]
class oasislmf.platform_api.client.FileEndpoint(session, url_endpoint, url_resource, logger=None)[source]

Bases: object

File Resources Endpoint for Upload / Downloading

logger[source]
session[source]
url_endpoint = ''[source]
url_resource = ''[source]
upload(ID, file_path, content_type=None)[source]
download(ID, file_path, overwrite=True, chuck_size=1024)[source]
get(ID)[source]
get_dataframe(ID)[source]

Return file endpoint as dict of pandas Dataframes:

either ‘application/gzip’: search and extract all csv or ‘text/csv’: return as dataframe

post(ID, data_object, content_type='application/json')[source]
post_dataframe(ID, data_frame)[source]
delete(ID)[source]
class oasislmf.platform_api.client.API_models(session, url_endpoint)[source]

Bases: ApiEndpoint

Used to Implement the default requests common to all Oasis API End points.

resource_file[source]
settings[source]
versions[source]
chunking_configuration[source]
scaling_configuration[source]
data_files(ID)[source]
create(supplier_id, model_id, version_id, data_files=[])[source]
update(ID, supplier_id, model_id, version_id, data_files=[])[source]
class oasislmf.platform_api.client.API_portfolios(session, url_endpoint)[source]

Bases: ApiEndpoint

Used to Implement the default requests common to all Oasis API End points.

accounts_file[source]
location_file[source]
reinsurance_info_file[source]
reinsurance_scope_file[source]
create(name)[source]
update(ID, name)[source]
create_analyses(ID, name, model_id)[source]

Create new analyses from Exisiting portfolio

class oasislmf.platform_api.client.API_analyses(session, url_endpoint)[source]

Bases: ApiEndpoint

Used to Implement the default requests common to all Oasis API End points.

lookup_errors_file[source]
lookup_success_file[source]
lookup_validation_file[source]
summary_levels_file[source]
input_file[source]
input_generation_traceback_file[source]
output_file[source]
run_traceback_file[source]
run_log_file[source]
settings_file[source]
settings[source]
create(name, portfolio_id, model_id, data_files=[])[source]
update(ID, name, portfolio_id, model_id, data_files=[])[source]
status(ID)[source]
generate(ID)[source]
run(ID)[source]
generate_and_run(ID)[source]
cancel_analysis_run(ID)[source]
cancel_generate_inputs(ID)[source]
cancel(ID)[source]
copy(ID)[source]
data_files(ID)[source]
sub_task_list(ID)[source]
class oasislmf.platform_api.client.APIClient(api_url='http://localhost:8000', api_ver='V2', username='admin', password='password', timeout=25, logger=None, **kwargs)[source]

Bases: object

logger[source]
api[source]
api_ver = ''[source]
models[source]
portfolios[source]
analyses[source]
data_files[source]
task_status[source]
oed_peril_codes()[source]
server_info()[source]
healthcheck()[source]
upload_inputs(portfolio_name=None, portfolio_id=None, location_fp=None, accounts_fp=None, ri_info_fp=None, ri_scope_fp=None)[source]
upload_settings(analyses_id, settings)[source]

Upload an analyses run settings to an API

Method to post JSON data or upload a settings file containing JSON data

Parameters

param analyses_id:

Analyses settings {id} from, v1/analyses/{id}/settings

type analyses_id:

int

param settings:

Either a valid filepath or dictionary holding the settings

type settings:

[str, dict]

return:

:rtype None

create_analysis(portfolio_id, model_id, analysis_name=None, analysis_settings_fp=None)[source]
run_generate(analysis_id, poll_interval=5)[source]

Generates the inputs for the analysis based on the portfolio. The analysis must have one of the following statuses, NEW, INPUTS_GENERATION_ERROR, INPUTS_GENERATION_CANCELLED, READY, RUN_COMPLETED, RUN_CANCELLED or RUN_ERROR.

run_analysis(analysis_id, analysis_settings_fp=None, poll_interval=5)[source]

Runs all the analysis. The analysis must have one of the following statuses, NEW, RUN_COMPLETED, RUN_CANCELLED or RUN_ERROR

download_output(analysis_id, download_path='', filename=None, clean_up=False, overwrite=True)[source]
cancel_generate(analysis_id)[source]

Cancels a currently inputs generation. The analysis status must be GENERATING_INPUTS

cancel_analysis(analysis_id)[source]

Cancels a currently running analysis. The analysis must have one of the following statuses, PENDING or STARTED