Skip to main content

Core loss modelling framework.

Project description

Oasis LMF logo

PyPI version FM Testing Tool

Oasislmf Testing Code Quality PiWind output check PiWind MDK

OasisLMF

The oasislmf Python package, loosely called the model development kit (MDK) or the MDK package, provides a command line toolkit for developing, testing and running Oasis models end-to-end locally, or remotely via the Oasis API. It can generate ground-up losses (GUL), direct/insured losses (IL) and reinsurance losses (RIL). It can also generate deterministic losses at all these levels.

Versioning and Updates

Current Stable Versions (Actively Supported)

Release Schedule

Starting in 2023, we transitioned to a yearly release cycle for our stable versions. At the start of Each year, we release a new stable version with an increased minor version number {major}.{minor}.{patch}. That version of oaisislmf is then 'frozen' into a branch matching the new version number, so for release {major}.{minor}.0 the code base is copied to a branch matching the version stable/{major}.{minor}.x, there are where backported features and fixes are applied. In general, we aim to maintain consistent output numbers within each stable version. (excluding bugs like output errors)

Monthly Stable Updates

Each month we provide updates to the last three stable version(s) which are viewed as 'actively maintaining'. So bug fixes will be backport and applied, where possible, without being asked. Older versions can be updated, but on an on request basis.

When a stable version has a monthly update release its patch version number is incremented, so from {major}.{minor}.{n} to {major}.{minor}.{n + 1}.

Features

For running models locally the CLI provides a model subcommand with the following options:

  • model generate-exposure-pre-analysis: generate new Exposure input using user custom code (ex: geo-coding, exposure enhancement, or dis-aggregation...)
  • model generate-keys: generates Oasis keys files from model lookups; these are essentially line items of (location ID, peril ID, coverage type ID, area peril ID, vulnerability ID) where peril ID and coverage type ID span the full set of perils and coverage types that the model supports; if the lookup is for a complex/custom model the keys file will have the same format except that area peril ID and vulnerability ID are replaced by a model data JSON string
  • model generate-oasis-files: generates the Oasis input CSV files for losses (GUL, GUL + IL, or GUL + IL + RIL); it requires the provision of source exposure and optionally source accounts and reinsurance info. and scope files (in OED format), as well as assets for instantiating model lookups and generating keys files
  • model generate-losses: generates losses (GUL, or GUL + IL, or GUL + IL + RIL) from a set of pre-existing Oasis files
  • model run: runs the model from start to finish by generating losses (GUL, or GUL + IL, or GUL + IL + RIL) from the source exposure, and optionally source accounts and reinsurance info. and scope files (in OED or RMS format), as well as assets related to lookup instantiation and keys file generation

The optional --summarise-exposure flag can be issued with model generate-oasis-files and model run to generate a summary of Total Insured Values (TIVs) grouped by coverage type and peril. This produces the exposure_summary_report.json file.

For remote model execution the api subcommand provides the following main subcommand:

  • api run: runs the model remotely (same as model run) but via the Oasis API

For generating deterministic losses an exposure run subcommand is available:

  • exposure run: generates deterministic losses (GUL, or GUL + IL, or GUL + IL + RIL)

The reusable libraries are organised into several sub-packages, the most relevant of which from a model developer or user's perspective are:

  • api_client
  • model_preparation
  • model_execution
  • utils

Minimum Python Requirements

Starting from 1st January 2019, Pandas will no longer be supporting Python 2. As Pandas is a key dependency of the MDK we are dropping Python 2 (2.7) support as of this release (1.3.4). The last version which still supports Python 2.7 is version 1.3.3 (published 12/03/2019).

Also for this release (and all future releases) a minimum of Python 3.10 is required.

Installation

The latest released version of the package, or a specific package version, can be installed using pip:

pip install oasislmf[==<version string>]

Alternatively you can install the latest development version using:

pip install git+{https,ssh}://git@github.com/OasisLMF/OasisLMF

You can also install from a specific branch <branch name> using:

pip install [-v] git+{https,ssh}://git@github.com/OasisLMF/OasisLMF.git@<branch name>#egg=oasislmf

macOS Apple Silicon (M1/M2/M3/M4)

OasisLMF installs natively on Apple Silicon Macs via pip install oasislmf. Ensure you have:

  • Python 3.10+ (the system Python on macOS is 3.9 — install via brew install python@3.12 or pyenv)
  • macOS 12 (Monterey) or later (required for scipy ARM64 wheels)

For optional geospatial extras (pip install oasislmf[extra]), also install:

brew install spatialindex geos

See docs/installation_for_mac.md for full details, troubleshooting, and ktools information.

Enable Bash completion

Bash completion is a functionality which bash helps users type their commands by presenting possible options when users press the tab key while typing a command.

Once oasislmf is installed you'll need to be activate the feature by sourcing a bash file. (only needs to be run once)

Local

oasislmf admin enable-bash-complete

Global

echo 'complete -C completer_oasislmf oasislmf' | sudo tee /usr/share/bash-completion/completions/oasislmf

JIT Cache Warmup

OasisLMF uses Numba JIT compilation for performance-critical calculations. The first run after installation incurs a one-time compilation overhead (2-6 minutes). It is preferable to pre-compile all ~191 JIT functions to reduce overhead and memory peak using:

oasislmf warmup

Sadly, at the moment, this doesn't work well on docker unless you can guaranty the run happen on the same type of machine. In that case you can run this after installation.

RUN pip install oasislmf && oasislmf warmup

Dependencies

System

The package provides a built-in lookup framework (oasislmf.model_preparation.lookup.OasisLookup) which uses the Rtree Python package, which in turn requires the libspatialindex spatial indexing C library.

https://libspatialindex.github.io/index.html

Linux users can install the development version of libspatialindex from the command line using apt.

[sudo] apt install -y libspatialindex-dev

and OS X users can do the same via brew.

brew install spatialindex

The PiWind demonstration model uses the built-in lookup framework, therefore running PiWind or any model which uses the built-in lookup, requires that you install libspatialindex.

GNU/Linux

For GNU/Linux the following is a specific list of required system libraries

  • Debian: g++ compiler build-essential, libtool, zlib1g-dev autoconf on debian distros

    sudo apt install g++ build-essential libtool zlib1g-dev autoconf

  • Red Hat: 'Development Tools' and zlib-devel

Python

Package Python dependencies are controlled by pip-tools. To install the development dependencies first, install pip-tools using:

pip install pip-tools

and run:

pip-sync

To add new dependencies to the development requirements add the package name to requirements.in or to add a new dependency to the installed package add the package name to requirements-package.in. Version specifiers can be supplied to the packages but these should be kept as loose as possible so that all packages can be easily updated and there will be fewer conflict when installing.

After adding packages to either *.in file:

pip-compile && pip-sync

should be ran ensuring the development dependencies are kept up to date.

ods_tools

OasisLMF uses the ods_tools package to read exposure files and the setting files The version compatible with each OasisLMF is manage in the requirement files. below is the summary:

  • OasisLMF 2.3.x => use ods_tools 3.2.x or later
  • OasisLMF 2.4.x => use ods_tools 4.0.x or later
  • OasisLMF 2.5.x => use ods_tools 5.0.x or later

Testing

To test the code style run:

flake8

To test against all supported python versions run:

tox

To test against your currently installed version of python run:

py.test

To run the full test suite run:

./runtests.sh

Publishing

Before publishing the latest version of the package make you sure increment the __version__ value in oasislmf/__init__.py, and commit the change. You'll also need to install the twine Python package which setuptools uses for publishing packages on PyPI. If publishing wheels then you'll also need to install the wheel Python package.

Using the publish subcommand in setup.py

The distribution format can be either a source distribution or a platform-specific wheel. To publish the source distribution package run:

python setup.py publish --sdist

or to publish the platform specific wheel run:

python setup.py publish --wheel

Creating a bdist for another platform

To create a distribution for a non-host platform use the --plat-name flag:

 python setup.py bdist_wheel --plat-name Linux_x86_64

 or

 python setup.py bdist_wheel --plat-name Darwin_x86_64

Manually publishing, with a GPG signature

The first step is to create the distribution package with the desired format: for the source distribution run:

python setup.py sdist

which will create a .tar.gz file in the dist subfolder, or for the platform specific wheel run:

python setup.py bdist_wheel

which will create .whl file in the dist subfolder. To attach a GPG signature using your default private key you can then run:

gpg --detach-sign -a dist/<package file name>.{tar.gz,whl}

This will create .asc signature file named <package file name>.{tar.gz,whl}.asc in dist. You can just publish the package with the signature using:

twine upload dist/<package file name>.{tar.gz,whl} dist/<package file name>.{tar.gz,whl}.asc

Documentation

License

The code in this project is licensed under BSD 3-clause license.

Project details


Release history Release notifications | RSS feed

This version

2.5.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oasislmf-2.5.3.tar.gz (681.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

oasislmf-2.5.3-cp313-cp313-win_amd64.whl (840.8 kB view details)

Uploaded CPython 3.13Windows x86-64

oasislmf-2.5.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

oasislmf-2.5.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

oasislmf-2.5.3-cp313-cp313-macosx_11_0_arm64.whl (845.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

oasislmf-2.5.3-cp312-cp312-win_amd64.whl (841.1 kB view details)

Uploaded CPython 3.12Windows x86-64

oasislmf-2.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

oasislmf-2.5.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

oasislmf-2.5.3-cp312-cp312-macosx_11_0_arm64.whl (845.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

oasislmf-2.5.3-cp311-cp311-win_amd64.whl (840.9 kB view details)

Uploaded CPython 3.11Windows x86-64

oasislmf-2.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

oasislmf-2.5.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

oasislmf-2.5.3-cp311-cp311-macosx_11_0_arm64.whl (846.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

oasislmf-2.5.3-cp310-cp310-win_amd64.whl (841.2 kB view details)

Uploaded CPython 3.10Windows x86-64

oasislmf-2.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

oasislmf-2.5.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

oasislmf-2.5.3-cp310-cp310-macosx_11_0_arm64.whl (846.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file oasislmf-2.5.3.tar.gz.

File metadata

  • Download URL: oasislmf-2.5.3.tar.gz
  • Upload date:
  • Size: 681.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for oasislmf-2.5.3.tar.gz
Algorithm Hash digest
SHA256 fe294ed09fc360f17d6057af6ee1ecc8fe8e28b367991f6172348e773875a0bc
MD5 39df6b64c5dec7bbf9ce779428d936bd
BLAKE2b-256 bca39bda6a018a0a8e866b4ce4163f404f052fa1a8b66f3aa3af9b57a24e9fb7

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: oasislmf-2.5.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 840.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for oasislmf-2.5.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 24a0c4284394c74373a9e36c09b55179e6809c75c4310ed3b0e186d2ae674366
MD5 ef76534d3d6218b085d9759cd0f69a82
BLAKE2b-256 60ae6f258813c7dd058c505e24f010571a715929bb65a5417f3ec2c1efc94cd2

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f1fd01b9a0d3296551c4ed8d91d2c74fe78a79e229d553a3b618019fe0d8a85b
MD5 8f6c1356551ca08f4d5f636e9d47f6e5
BLAKE2b-256 617553ce45b84f818ea7ac4bebe808347e30eb4f49e64c84fe3c5d21dc6df972

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9c14ccbedd21b287e3a6f8ae3ef29ee2ea51371fa90b723909f75a52b0be2dc5
MD5 e1a4c9c68baaa58e04b17e7fe1f6cd19
BLAKE2b-256 f10b1c12b4af9209cdfdfdb01257d48dcf0acb473f039ec3d5c5d104e7d2ff15

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6710cfa6d8b39db1415544d4cdd8c9b3e3c14470541be909c161df3159210c67
MD5 d964cf7d3ae7bc8bd35c9498a93d20ff
BLAKE2b-256 a361e0b3713fe317d9547440f45ffc1e74e916fa85856e9f71ae82691a77ec82

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: oasislmf-2.5.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 841.1 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for oasislmf-2.5.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 10eeecbf15dd64142ec28c0ed0cca005a351c421ef46a3b1f2f294148e86add2
MD5 5798a245811e2a40111a49cb55204ec7
BLAKE2b-256 74ab31424c333716da9e331012099659bed154f4786eaaeac753d4a168cf6219

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cefa24d00fd0f39c9d88965f9b6c74cff94713b533a592378204bc5cb8f88c37
MD5 3f8a02b8f99eda53af969987a8f9873d
BLAKE2b-256 c8da3ddc8283c6bdda631d41d8f73090c4dc7d9dec67d5b546792170f8d288a0

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bbd75059675e5c14cd96083bb328e9084a6f102fafdcb2a83074578c06dfef4e
MD5 0f42a1ccb60ea5b49845bab98e982f5a
BLAKE2b-256 3fa9a35120499881485a92aeb73a8f1ce3c787e8f27374b8b089811fa3db1286

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 80c2ef6f5cd733c8ca4a2f7074fefb39f3732672ab63ba43e8e7f2421446e165
MD5 32873c33cfb4e6a64db3b09729a6c403
BLAKE2b-256 8d89215bf89d8ef056e21bcc11642c7deb38a1653bfbaafca5fcf040fd91bfef

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: oasislmf-2.5.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 840.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for oasislmf-2.5.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 dbfe3f10b6afddb43e4091c35a473f423b5c9863ebe84ee180626c4c329f1647
MD5 5a77162697593c179ef1ca5edd067771
BLAKE2b-256 745ae3e654f7131a2086259c25d55690d27b66241c7d96c1fa7b54bfb4ba2483

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5ad844311d738ea98283b4bb42fd4df56d9fa31563de4575599114bea388c55c
MD5 d12f4aec5dc0513000eaf0ba9b02bf06
BLAKE2b-256 033748d635aaae93bc173bffcb58eb1cfe75045af6a2372ae750aa2ad02ab61c

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 064524e267e4a7c8fa2093789a5461b3639d61a7a856e243f7f86bfb4adca080
MD5 aedf6040f541ca2e0d315200314b8d38
BLAKE2b-256 3506456b17a9704a79760201ff39831f239f86a2d912fa794982a298ff35c2a1

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a69a33753f99d55d1310ad18af2f8aa0feb7b29dd915eb1f613e33f9acaaf412
MD5 2d2b696ed22ad992754637a5836b8bc7
BLAKE2b-256 34a1185ca29f2c333f1dc0cdbf405a0a51166658ed12d92181688cd8744904a4

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: oasislmf-2.5.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 841.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for oasislmf-2.5.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 50f86a8272f4e5ca35c217cccabbaf2f507a9ae679d575a742ae94da5bec87b6
MD5 0dba5000412a42d2738719b2d5f76eac
BLAKE2b-256 ea524e9b8a600e7bef7c48867761f314f6dd9a27fd15baadb658aedd1361c82b

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e2f4244feb274180282bdc7a7e7184f4b931e5d28d1d4e257d76fe28672aba44
MD5 51d34172ea885464af855fd9eba18b2f
BLAKE2b-256 8fb6e3e6e21385940683fbed28d01f621002941c7b1e2f063ebc8e43c52ad78f

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f94fabc27a0bbf79139c542272cd00ba33e43547705787abb3515b0234b1fcfc
MD5 fbf408c02a54f1dce4458e48d6e0b448
BLAKE2b-256 a772c5b868b6e4b29e6688a558ac8be43000ab79684aac9f083526cae75cd1b5

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d78c24472df2d6bfaf1442110bbec7f20a00d6a9923890f43e5dac2aff023fb2
MD5 36f0713146ec345cbd39c135280397ea
BLAKE2b-256 47008b8927648152e588577304c1227bce0e8fd1afa5419e847f9ceb5fa8b4ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page