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/

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.4

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.4.tar.gz (720.6 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.4-cp313-cp313-win_amd64.whl (885.6 kB view details)

Uploaded CPython 3.13Windows x86-64

oasislmf-2.5.4-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.4-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.4-cp313-cp313-macosx_11_0_arm64.whl (890.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

oasislmf-2.5.4-cp312-cp312-win_amd64.whl (885.8 kB view details)

Uploaded CPython 3.12Windows x86-64

oasislmf-2.5.4-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.4-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.4-cp312-cp312-macosx_11_0_arm64.whl (890.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

oasislmf-2.5.4-cp311-cp311-win_amd64.whl (885.8 kB view details)

Uploaded CPython 3.11Windows x86-64

oasislmf-2.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

oasislmf-2.5.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

oasislmf-2.5.4-cp311-cp311-macosx_11_0_arm64.whl (891.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

oasislmf-2.5.4-cp310-cp310-win_amd64.whl (886.1 kB view details)

Uploaded CPython 3.10Windows x86-64

oasislmf-2.5.4-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.4-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.4-cp310-cp310-macosx_11_0_arm64.whl (891.3 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: oasislmf-2.5.4.tar.gz
  • Upload date:
  • Size: 720.6 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.4.tar.gz
Algorithm Hash digest
SHA256 1ebe9541863cfd8a1e486fb5e33e6765123e59476eb2da9776962c440b5c56c4
MD5 7a4e7631dffef8f09ea0aabc4cb4527e
BLAKE2b-256 7333c0f2015e746fe27eecf26b7085eaf4a0e68ab3fbc2547c0d12d22f796cf8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oasislmf-2.5.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 885.6 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.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ef60463cfe6ed811cce2c8ad542859b2ff441bcfb261f844b41f5b2157d80d4a
MD5 9578c34b06aaa992ebfaee315b96e40e
BLAKE2b-256 91dd38ff73cc3207ad15bf9fd2ed5cca346004f56907ceb0c9035d635212b95a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oasislmf-2.5.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08783662690c0fa80fa47646d9802473d77a8f0c924b3b81095b00ed6d38f46d
MD5 ee2aaeff8fb4ffb7522db1abb9930840
BLAKE2b-256 1b474e24e9dd3cb0abefa6fa5fb5e165a5ce8c194dde4f364fec01f6c6bb6e5d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oasislmf-2.5.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e3843c0c50dc83a8b8993798de44f39e4f56aeeecd5943d5463522b01cc04336
MD5 c13ed3f77450b265ca6f31981dd84855
BLAKE2b-256 3d6973a6b0e266c99aa954c2f19f6afc1a5d2fbf56a7d95d4ea4e9d3439296bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oasislmf-2.5.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a285aa6b7f3d3a2653e9fea093e4f49054b4622cb9a28a534453ae1d4f38a4b
MD5 f2e777899bb505cfd4e6f7cffe2acb92
BLAKE2b-256 5860e3bbb7670a03c7780a2339b61eb83a3b1f169cd716c22d97982fd3679c62

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oasislmf-2.5.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 885.8 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.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2c7f574c5e61d3e90e7d76ac95106af8d37c2f56ec18eb4a1a5d24166b24e0a1
MD5 5decf454742b28026f5c7e9734d2cd68
BLAKE2b-256 2581d96129d307dc9a7a3c6c10657bddf9175f584c7a259553d3609639d6e5a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oasislmf-2.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 54c397e2a13f6c4706a57a2013182af42fa9e322c89f0f1e66bc4a43379fd943
MD5 4f932ca89885e4617bb18a83712868ac
BLAKE2b-256 39b69338275df4aa48a4c183f84755e3e527c2bd1384328df4faf9b06f8df84e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oasislmf-2.5.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 781875c2a5338571764c619d1aa13c6b417d5745d2fb3c00ededd31ed03bfee3
MD5 aa2a8ab24ab949f7b64ad52f17b641e1
BLAKE2b-256 eede205e939dbb83a2720d1ec4ca4a9468b5167d43bdd54e6123de42e1fe8dc0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oasislmf-2.5.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 878b84f02ead9309fc6836d621a45494bb2ffaed4db2c74702f3909c26a9e041
MD5 f26208547f3e8d1ce884ff4edb7392df
BLAKE2b-256 437d279b39d13c3af96ecf6d43f1e21f3ccd7b2b5e7028f94dfb856a11f3f5d9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oasislmf-2.5.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 885.8 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.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 aa139b30e9080f70f6f7fb1ae96f1feddfd69edc801fb81801b00f696bc1c424
MD5 3a85d08b256822150d3847b44e7866eb
BLAKE2b-256 d61dbeb0415a1f704646d073e17e1327948c0b0ce0c4aa7c11f9a5b9d8c77724

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oasislmf-2.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 47e2ed0d6bf7824d06888ee4995ab173cc69d5a8df06a6fe99223c9b6a5570ed
MD5 5c674af1c9b41b7637280b5e94593c6a
BLAKE2b-256 f8c294b3b6f7b0714ce0ee71dcb31154072f7a20d20a2612634d2f830609a4c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oasislmf-2.5.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f3441584af09fbf73cc90d45dc6d9bf40e910aa1c9bd29c2f49de65fe6fbb631
MD5 d228d96cdbcc88e61a6a7aeee810d1c9
BLAKE2b-256 95ede23fdd06260710086ce831631b7ce8db72a9d151dcc529c17539ab95ee37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oasislmf-2.5.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ddc28c643e95d2c777123b9d6f461b5e81c54bd162d7fe5200c11fa7a3863e6
MD5 e90f197ba8b032d4335a9b6101a817c8
BLAKE2b-256 19ef56bc3eae9d73ef6ff0154ed164b42efee83cf1b53d26b7725b2e11013d4d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oasislmf-2.5.4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 886.1 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.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2273876c7ff10b6b7887ea1194d11cd3a35c86b0d3b9e01ff1cc4eda3d82232d
MD5 0469cf883c82c736d94c30d589ffffa9
BLAKE2b-256 96468927e8995174c88b036a46a6579c3e058ba49b5875c6579fd206beb59b75

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oasislmf-2.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3231abc80d1eb1277786842f5cee8d1f724c9044224fbc916de62a931fb9d80a
MD5 f79c441e2352aeb6d23afa0ff3d506c9
BLAKE2b-256 5233348fe09aa95b4ccd5c87e86b43a235025099c5564daa9b74fd1041b9ef0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oasislmf-2.5.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9027e45b84b355f8451361ff998e129bf45fb611a4125f1719e430da89b4466e
MD5 aa309c13036065c88f58e1de61b715d6
BLAKE2b-256 ae3970b398cef2bc425628111f5d222d4cc8288d351329fd430088340a9cc568

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oasislmf-2.5.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 450bc75f258c63e7fb43708fb6731e31ee3a1b298a15bacca901eeb913e0131e
MD5 f8ce8406fa8b6e28815985c37d1cb4d6
BLAKE2b-256 1af51d8093158fca74385e6306bdc66c4bb3393ef873989a248d9c42afbbb99f

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