{ "info": { "author": "Sandeep Murthy", "author_email": "smurthy@protonmail.ch", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: End Users/Desktop", "Intended Audience :: Financial and Insurance Industry", "Intended Audience :: Science/Research", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "License :: Public Domain", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Topic :: Scientific/Engineering" ], "description": "[![PyPI version](https://badge.fury.io/py/oedtools.svg)](https://badge.fury.io/py/oedtools)\n[![Build Status](https://travis-ci.com/sr-murthy/oedtools.svg?token=5KnvNGapkmzduNDLuQdw&branch=master)](https://travis-ci.com/sr-murthy/oedtools)\n\n# oedtools\n\n`oedtools` is a command-line file validation, query and data sampling toolkit for the Simplitium Open Exposure Data (OED) (re)insurance exposure data format.\n\n**Note**: the repository and package are based on the current OED version 1.0.3 - this is stored in the schema version file.\n\nThe main user-level features currently include\n\n* **file validation** - command-line validation (headers + data) of OED account (`acc`), location (`loc`), reinsurance info. (`reinsinfo`) and reinsurance scope (`reinsscope`) input CSV files\n* **column queries** - command-line querying of columns based on properties such as headers (column names) or header substrings, column descriptions containing keywords, Python, SQL or Numpy data types, default values, and required and/or nonnull properties\n* **sampling column data** - command-line sampling of column data, consistent with the column range or data type range or a specific column validation function\n\n(The query toolkit will be augmented in future releases with the ability to make command line queries of the values profile, which currently can only be examined directly as a dict.)\n\nValidation and sampling are based on two types of interrelated but independent data structures built in to the package.\n\n* **file schemas** - separate JSON files for the acc., loc., reins. info. and reins. scope files defining the properties of each column in each file\n* a **values profile** - a JSON profile of the data that the files can store, but independent of considerations of the column structure, including categories and subcategories of values, column headers and specific column ranges associated with the subcategories (if they exist), and column data validation and sampling methods (where available).\n\nThe schemas define the column structure of OED files and provide a \"column view\" of the files, and the values\nprofile defines the properties of the data that occur in the columns and provides a \"data view\" of the files.\n\n## Installation and Requirements\n\nInstallation is via `pip` (Python 3).\n\n pip install oedtools\n\nThe only package requirement is a Python >=3.6 interpreter. It is best to install and use the package in a Python virtual environment.\n\n## Features\n\nThe command line interface is invoked via `oed` and provides two main command groups.\n\n* `validate` (`oed validate`) - for validating files (column headers + data), or only the headers in files\n* `columns` (`oed columns`) - for searching for columns with required properties, and for sampling column data\n\nThere is a utility subcommand named `version` which can be used to get the OED schema version (currently `1.0.3`) the package uses, or the package version (currently `0.1.8`). Usage is\n\n $ oed version\n 1.0.3\n\n $ oed version --package\n 0.1.9\n\n### Validation\n\n#### Files (headers + data)\n\nFile validation is performed via `oed validate file`, and includes validation of the column headers and data.\n\n usage: oed validate file [-h] -f INPUT_FILE_PATH -t SCHEMA_TYPE\n\n optional arguments:\n -h, --help show this help message and exit\n -f INPUT_FILE_PATH, --input-file-path INPUT_FILE_PATH\n OED input file path\n -t SCHEMA_TYPE, --schema-type SCHEMA_TYPE\n File schema type - \"loc\", \"acc\", \"reinsinfo\", or\n \"reinsscope\"\n\nHeaders and data are validated separately, and a combined status report is printed to the console, e.g.\n\n (myvenv) $ oed validate file -t 'loc' -f /path/to/location.csv\n /path/to/location.csv:11:40: Invalid value \"WWTC;WEC;BFR;OO1\" in \"LocPerilsCovered\" - check the column or data type range: OED error: E371 Out of range data found in column\n\n /path/to/location.csv:18:493: Invalid value \"-25000\" in \"LocMinDed6All\" - check the column or data type range: OED error: E371 Out of range data found in column\n\n /path/to/location.csv:1:870: \"SubArea\" is not a valid column in any OED schema: OED error: E303 Not a valid column in any OED schema\n\n /path/to/location.csv:1:870: \"SubArea\" is an invalid column in the OED \"loc\" schema: OED error: E304 Not a valid column in the given OED schema\n\n /path/to/location.csv:2:928: Invalid data type for value \"s\" in \"CondPriority\" - expected type \"\", found type \"\": OED error: E351 Invalid data type(s) in column\n\n /path/to/location.csv:1:-1: \"LocCurrency\" is a required column in an OED \"loc\" file but is missing: OED error: E331 Missing required column in file\n\nIf there are no errors in the file this is indicated with a short message, e.g.\n\n (myvenv) $ oed validate file -t 'acc' -f /path/to/account.csv\n \"/path/to/account.csv\" file validation complete: no exceptions or errors\n\nHeader-related errors currently include\n\n* **non-OED headers** - headers not currently defined in any OED schema\n* **incompatible OED headers** - (OED) headers in a file incompatible with the file schema\n* **required but missing** headers - headers which are mandatory in a given file schema but not present in an actual input file\n\nData-related errors currently include\n\n* **null values in non-null columns** - a non-null column is defined as a column which must not contain any null values\n* **column values with incompatible data types** - values with data types inconsistent with the column data type, as defined in the given schema, e.g. string values in an integer or floating point column\n* **out of range values** - values not in the defined range of a column (this can be either a specific column range defined in the values profile, or a range inferred from the column data type defined in the schema)\n\n**Note**: data validation (and sampling) is facilitated via the values profile, which defines the categories and subcategories of data values that can occur in the various columns, independently of the schemas. The values profile defines, where applicable, the ranges of values associated with each subcategory and links these ranges to columns in the relevant schemas. It also defines, where applicable, methods for validation and sampling. Currently, the categories of data covered by the values profile include\n\n* **attachments**\n* **construction codes**\n* **country codes**\n* **coverage types**\n* **currencies**\n* **deductible codes**\n* **deductible types**\n* **deductibles**\n* **geocoding**\n* **limit codes**\n* **limit types**\n* **limits**\n* **location properties**\n* **occupancy types**\n* **peril codes**\n* **reins. percentages**\n* **reins. risk levels**\n* **reins. types**\n* **shares**\n* **TIVs**\n* **years**\n\nThis will be extended in future releases to cover all possible values.\n\n#### Headers\n\nThis works in a very similar way to file validation, except that it is only for validating the headers in a given file. The headers can be provided either by providing a file path, or as a comma-separated string in quotation marks, e.g.\n\n (myvenv) $ oed validate headers -t 'loc' -f /path/to/location.csv\n /path/to/location.csv:1:870: \"SubArea\" is not a valid column in any OED schema: OED error: E303 Not a valid column in any OED schema\n\n /path/to/location.csv:1:870: \"SubArea\" is an invalid column in the OED \"loc\" schema: OED error: E304 Not a valid column in the given OED schema\n\n /path/to/location.csv:1:-1: \"LocCurrency\" is a required column in an OED \"loc\" file but is missing: OED error: E331 Missing required column in file\n\n### Searching for Columns and Sampling Column Data\n\n#### Searching for Columns\n\nColumns can be queried using `oed columns info` - results are always printed to console as JSON, in ascending alphabetic order by (case insensitive) header.\n\n usage: oed columns info [-h] [-t SCHEMA_TYPES] [-m COLUMN_HEADERS]\n [-d DESCRIPTIONS] [-r] [-n] [-e DEFAULTS]\n [-p PYTHON_DTYPES] [-s SQL_DTYPES] [-y NUMPY_DTYPES]\n [-a]\n\n optional arguments:\n -h, --help show this help message and exit\n -t SCHEMA_TYPES, --schema-types SCHEMA_TYPES\n List of file schema types; must be one of \"acc\",\n \"loc\", \"reinsinfo\", \"reinsscope\" - a comma-separated\n string enclosed in quotation marks\n -m COLUMN_HEADERS, --column-headers COLUMN_HEADERS\n List of column headers or header substrings - a comma-\n separated string enclosed in quotation marks\n -d DESCRIPTIONS, --descriptions DESCRIPTIONS\n List of column descriptions or description substrings\n - a comma-separated string enclosed in quotation marks\n -r, --required Is the column a required column in the file?\n -n, --nonnull Is the column required not to have any null values?\n -e DEFAULTS, --defaults DEFAULTS\n List of default values - a comma-separated string\n enclosed in quotation marks\n -p PYTHON_DTYPES, --python-dtypes PYTHON_DTYPES\n List of Python data types - only \"int\", \"float\", \"str\"\n are supported; a comma-separated string enclosed in\n quotation marks\n -s SQL_DTYPES, --sql-dtypes SQL_DTYPES\n List of SQL data types - a comma-separated string\n enclosed in quotation marks\n -y NUMPY_DTYPES, --numpy-dtypes NUMPY_DTYPES\n List of Numpy data types - a comma-separated string\n enclosed in quotation marks\n -a, --headers-only Only return the column headers\n\nHere are four queries that illustrate the possibilities of `oed columns info`.\n\n1. Display full column information for the `BuildingTIV` and `BITIV` columns only (header names are case insensitive in the query).\n\n (myvenv) $ oed columns info -m 'buildingtiv, bitiv'\n [\n {\n \"blank\": false,\n \"column_range\": [\n 0.0,\n 3.4e+38\n ],\n \"column_sampling\": \"column range\",\n \"column_validation\": \"column range\",\n \"default\": null,\n \"desc\": \"Business Interruption (BI) Total Insured Value\",\n \"dtype_range\": [\n -3.4e+38,\n 3.4e+38\n ],\n \"entity\": \"Loc\",\n \"field_name\": \"BITIV\",\n \"numpy_dtype\": \"float32\",\n \"oed_db_field_name\": null,\n \"oed_db_table\": \"Locations\",\n \"py_dtype\": \"float\",\n \"required\": \"R\",\n \"secmod\": null,\n \"sql_dtype\": \"real\"\n },\n {\n \"blank\": false,\n \"column_range\": [\n 0.0,\n 3.4e+38\n ],\n \"column_sampling\": \"column range\",\n \"column_validation\": \"column range\",\n \"default\": null,\n \"desc\": \"Building Total Insured Value\",\n \"dtype_range\": [\n -3.4e+38,\n 3.4e+38\n ],\n \"entity\": \"Loc\",\n \"field_name\": \"BuildingTIV\",\n \"numpy_dtype\": \"float32\",\n \"oed_db_field_name\": null,\n \"oed_db_table\": \"Locations\",\n \"py_dtype\": \"float\",\n \"required\": \"R\",\n \"secmod\": null,\n \"sql_dtype\": \"real\"\n }\n ]\n\n **Note**: the schema type (specified using option `-t`) isn't required if the columns you're looking for are unique.\n\n2. Display the headers only of all columns in the `loc` file schema with the header substring `6all` and with the `int` or `float` (Python) data type.\n\n (myvenv) $ oed columns info -t 'loc' -m '6all' -p 'int, float' --headers-only\n [\n \"LocDed6All (Loc)\",\n \"LocDedCode6All (Loc)\",\n \"LocDedType6All (Loc)\",\n \"LocLimit6All (Loc)\",\n \"LocLimitCode6All (Loc)\",\n \"LocLimitType6All (Loc)\",\n \"LocMaxDed6All (Loc)\",\n \"LocMinDed6All (Loc)\"\n ]\n\n **Note 1**: as some OED column headers indicate coverage type at the tail end of the header (`1building`, `2other`, `3contents`, `4bi`, `5pd`, `6all`), the header substring option `-m` can be used, as above, to search for columns based on coverage type.\n\n **Note 2**: The schema type is displayed in parentheses for clarity, as some columns like `LocNumber` and `AccNumber` can be present in different file types (`LocNumber` can occur in a ``loc`` or ``reinsscope`` file, and `AccNumber` can occur in a `loc` or `acc` or `reinsscope` file).\n\n3. Display the headers only of all required and non-null columns in the `acc` file schema.\n\n (myvenv) $ oed columns info -t 'acc' --required --nonnull --headers-only\n [\n \"AccCurrency (Acc)\",\n \"AccNumber (Acc)\",\n \"PolNumber (Acc)\",\n \"PolPerilsCovered (Acc)\",\n \"PortNumber (Acc)\"\n ]\n\n4. Display the headers only of all columns in all the schemas whose descriptions contain the keyword \"percent\", i.e. we're looking here for all percentage-valued columns.\n\n (myvenv) $ oed columns info -d 'percent' --headers-only\n [\n \"BrickVeneer (Loc)\",\n \"BuildingExteriorOpening (Loc)\",\n \"CededPercent (ReinsScope, ReinsInfo)\",\n \"DeemedPercentPlaced (ReinsInfo)\",\n \"LocParticipation (Loc)\",\n \"PercentComplete (Loc)\",\n \"PercentSprinklered (Loc)\",\n \"PlacedPercent (ReinsInfo)\",\n \"ScaleFactor (Acc)\",\n \"SurgeLeakage (Loc)\",\n \"TreatyShare (ReinsInfo)\"\n ]\n\n#### Sampling Column Data\n\nColumn data can be sampled using `oed columns sample`.\n\n (myvenv) $ oed columns sample --help\n usage: oed columns sample [-h] -t SCHEMA_TYPE -m COLUMN_HEADER\n [-n SAMPLE_SIZE]\n\n optional arguments:\n -h, --help show this help message and exit\n -t SCHEMA_TYPE, --schema-type SCHEMA_TYPE\n List of file schema types; must be one of \"acc\",\n \"loc\", \"reinsinfo\", \"reinsscope\" - a comma-separated\n string enclosed in quotation marks\n -m COLUMN_HEADER, --column-header COLUMN_HEADER\n Column header\n -n SAMPLE_SIZE, --sample-size SAMPLE_SIZE\n Sample size\n\nHere are three examples.\n\n1. Sampling reins. peril code sequences \n\n (myvenv) $ oed columns sample -t 'loc' -m 'locperil'\n [\n \"BBF;QEQ;WSS;ZIC\",\n \"ORF;QEQ;QLS;QQ1\",\n \"AA1;BB1;QEQ;ZST\",\n \"BB1;MNT;QLS;ZIC\",\n \"MTR;QSL;WTC;ZZ1\",\n \"BSK;QSL;WTC;WW2\",\n \"BSK;QEQ;QSL;WW2\",\n \"MNT;QEQ;XX1;ZST\",\n \"BFR;OO1;WEC;XX1\",\n \"QQ1;WW1;XX1;ZIC\"\n ]\n\n **Note 1**: sample size can be specified using the `-n` option, which has the default value of `10`.\n\n **Note 2**: Column sampling is based on the values profile that describes properties of OED data entities, not on columns defined in the schemas. This means that sampling a column whose values fall in the same subcategory in the values profile as that of another column will produce similar results, e.g. sampling `LocPeril` will produce similar results to sampling `AccPeril` or `ReinsPeril`, because all three fall into the category of `peril codes` in the values profile.\n\n2. Sampling reins. info. currency codes.\n\n (myvenv) $ oed columns sample -t 'reinsinfo' -m 'reinscurrency'\n [\n \"MOP\",\n \"SUR\",\n \"YER\",\n \"HKD\",\n \"ROL\",\n \"JOD\",\n \"RUR\",\n \"GHS\",\n \"MNT\",\n \"BYB\"\n ]\n\n3. Sampling loc. occupancy codes.\n\n (myvenv) $ oed columns sample -t 'loc' -m 'occupancycode'\n [\n 3643,\n 2696,\n 3753,\n 3743,\n 1126,\n 1382,\n 2608,\n 3951,\n 2392,\n 2163\n ]\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sr-murthy/oedtools", "keywords": "Simplitium,Open Exposure Data (OED),exposure,insurance,reinsurance,catastrophe modelling", "license": "GPL 3", "maintainer": "Sandeep Murthy", "maintainer_email": "smurthy@protonmail.ch", "name": "oedtools", "package_url": "https://pypi.org/project/oedtools/", "platform": "", "project_url": "https://pypi.org/project/oedtools/", "project_urls": { "Homepage": "https://github.com/sr-murthy/oedtools" }, "release_url": "https://pypi.org/project/oedtools/0.1.9/", "requires_dist": [ "argparsetree (>=0.0.6)", "numpy (>=1.14.0)", "pandas (>=0.24.2)" ], "requires_python": ">=3.6", "summary": "Command-line OED file validation and query toolkit for the Simplitium OED (re)insurance exposure data format", "version": "0.1.9" }, "last_serial": 5763211, "releases": { "0.1.9": [ { "comment_text": "", "digests": { "md5": "49aa06cff7291392f8f5590aee491595", "sha256": "051508eff9279ce73757d5e63517cd364cdeff5d1adbe8c089ab50b06f8ddab2" }, "downloads": -1, "filename": "oedtools-0.1.9-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "49aa06cff7291392f8f5590aee491595", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 327103, "upload_time": "2019-08-31T04:04:50", "url": "https://files.pythonhosted.org/packages/b9/44/9e092c432905cd1d4e5aa0728332260276580b6acbdc1a0bae09fafd7844/oedtools-0.1.9-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "384e92890beac8e5b71b30cd41570a4a", "sha256": "ab2a4f8ab76c5d8939a7011968e5a5b995ef94e95663b4802f2feba857dc56e3" }, "downloads": -1, "filename": "oedtools-0.1.9.tar.gz", "has_sig": true, "md5_digest": "384e92890beac8e5b71b30cd41570a4a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 328743, "upload_time": "2019-08-31T04:04:59", "url": "https://files.pythonhosted.org/packages/6f/13/c55de07a36e3aeff3c065afb55444801c2ec083740f4f1307ce3ac9a8608/oedtools-0.1.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "49aa06cff7291392f8f5590aee491595", "sha256": "051508eff9279ce73757d5e63517cd364cdeff5d1adbe8c089ab50b06f8ddab2" }, "downloads": -1, "filename": "oedtools-0.1.9-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "49aa06cff7291392f8f5590aee491595", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 327103, "upload_time": "2019-08-31T04:04:50", "url": "https://files.pythonhosted.org/packages/b9/44/9e092c432905cd1d4e5aa0728332260276580b6acbdc1a0bae09fafd7844/oedtools-0.1.9-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "384e92890beac8e5b71b30cd41570a4a", "sha256": "ab2a4f8ab76c5d8939a7011968e5a5b995ef94e95663b4802f2feba857dc56e3" }, "downloads": -1, "filename": "oedtools-0.1.9.tar.gz", "has_sig": true, "md5_digest": "384e92890beac8e5b71b30cd41570a4a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 328743, "upload_time": "2019-08-31T04:04:59", "url": "https://files.pythonhosted.org/packages/6f/13/c55de07a36e3aeff3c065afb55444801c2ec083740f4f1307ce3ac9a8608/oedtools-0.1.9.tar.gz" } ] }