Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.2.0 #87

Merged
merged 28 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5e186c4
update ci
sambles Jul 17, 2023
163cd81
Merge pull request #49 from OasisLMF/feautre/1323-reorganize-branches
sambles Jul 17, 2023
cbd95cd
Fix/improve check perils (#52)
sstruzik Jul 20, 2023
49f89c1
Add footprint file suffix options (#54)
hchagani-oasislmf Aug 4, 2023
71069fc
make string column are writable when reading from parquet (#59)
sstruzik Sep 12, 2023
bcbd8e1
Add options to enable/disable post loss amplification, and set second…
hchagani-oasislmf Sep 12, 2023
26072d6
Model_settings, allow additional properties under 'data_settings' (#61)
sambles Sep 13, 2023
81f1e34
Merge branch 'stable/3.1.x'
sambles Sep 18, 2023
975651f
Add fields for running aalcalcmeanonly ktools component (#62)
hchagani-oasislmf Oct 5, 2023
b4de4aa
Merge branch 'stable/3.1.x'
sambles Oct 6, 2023
ea91bb7
Update model_settings_schema.json adding event set optional dependenc…
fl-ndaq Oct 25, 2023
3c56b7c
Fix/forex case error (#70)
sstruzik Nov 3, 2023
1837c1c
Feature/versioning (#66)
ncerutti Nov 10, 2023
09d32f4
Feature/peril filter (#73)
sstruzik Nov 10, 2023
6f4e2d8
Merge branch 'stable/3.1.x'
sambles Nov 10, 2023
0f47c4a
Fix missing model settings valid metrics (#77)
sambles Dec 11, 2023
6e28cd1
Added fields to analysis settings schema (#80)
ncerutti Dec 11, 2023
32731cb
Merge branch 'stable/3.1.x'
sambles Dec 11, 2023
29a621e
Added worker run_mode to model_settings (#86)
sambles Jan 24, 2024
290a39b
Remove warning message (#84)
sambles Jan 29, 2024
54338a2
Update model_settings_schema.json allowing additional properties for …
fl-ndaq Jan 29, 2024
e63bf1a
Add vulnerability adjustments field to schema (#81)
ncerutti Jan 29, 2024
d642c08
Lot3 integration with ODS-tools package (#88)
sambles Feb 6, 2024
66b3303
Set package to version 3.2.0
awsbuild Feb 6, 2024
61e2668
Update changelog
awsbuild Feb 6, 2024
11351b4
Fix CI workflow default branches (#89)
sambles Feb 6, 2024
7d302fa
Merge branch 'main' into release/3.2.0
sambles Feb 6, 2024
5b031ca
Update changelog
awsbuild Feb 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,24 +168,6 @@ jobs:
name: bin_package
path: ${{ github.workspace }}/

- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PYPI_SIGNING_KEY }}
passphrase: ${{ secrets.GPG_PYPI_SIGNING_PASS }}

- name: GPG sign Source package
working-directory: ${{ github.workspace }}
run: |
gpg --batch --no-tty --passphrase-fd 0 --detach-sign -a ${{ needs.package.outputs.src_filename }}

- name: GPG sign Wheel package
working-directory: ${{ github.workspace }}
run: |
gpg --batch --no-tty --passphrase-fd 0 --detach-sign -a ${{ needs.package.outputs.whl_filename }}


# --- Create Release --- #
- name: Push changes
run: |
Expand All @@ -204,7 +186,6 @@ jobs:
draft: false
prerelease: ${{ env.PRE_RELEASE }}


# --- Attach build assest --- #
- name: Upload Source package
id: upload-source-release-asset
Expand Down Expand Up @@ -234,19 +215,13 @@ jobs:
run: pip install twine

- name: PYPI - Source package
run: |
twine upload \
${{ needs.package.outputs.src_filename }} \
${{ needs.package.outputs.src_filename }}.asc
run: twine upload ${{ needs.package.outputs.src_filename }}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

- name: PYPI - Linux package
run: |
twine upload \
${{ needs.package.outputs.whl_filename }} \
${{ needs.package.outputs.whl_filename }}.asc
run: twine upload ${{ needs.package.outputs.whl_filename }}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-oasislmf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
required: false

env:
oasislmf_branch: ${{ github.event_name != 'workflow_dispatch' && 'stable/1.28.x' || inputs.oasislmf_branch }}
oasislmf_branch: ${{ github.event_name != 'workflow_dispatch' && 'main' || inputs.oasislmf_branch }}

jobs:
build_ods:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:

jobs:
platform_testing:
uses: OasisLMF/OasisPlatform/.github/workflows/test-python.yml@main
uses: OasisLMF/OasisPlatform/.github/workflows/test-python_api.yml@main
secrets: inherit
with:
ods_branch: ${{ github.ref }}
platform_branch: ${{ github.event_name != 'workflow_dispatch' && 'main-platform1' || inputs.platform_branch }}
platform_branch: ${{ github.event_name != 'workflow_dispatch' && 'main' || inputs.platform_branch }}
24 changes: 19 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,22 @@ on:
required: false

jobs:
build:
build-ods:
uses: ./.github/workflows/build.yml
secrets: inherit
with:
oed_spec_branch: ${{ inputs.oed_spec_branch }}

build-odm:
uses: OasisLMF/OasisDataManager/.github/workflows/build.yml@main
secrets: inherit
with:
odm_branch: ${{ github.event_name != 'workflow_dispatch' && 'develop' || inputs.ods_branch }}

test:
name: Run Pytest
runs-on: ubuntu-latest
needs: build
needs: [build-ods, build-odm]
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
Expand All @@ -31,17 +37,25 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Download package
- name: Download package (ODS-tools)
uses: actions/download-artifact@v3
with:
name: bin_package
path: ${{ github.workspace }}/

- name: Download package (OasisDataManager)
uses: actions/download-artifact@v3
with:
name: odm_bin_package
path: ${{ github.workspace }}/

- name: install package
run: pip install ${{ needs.build.outputs.whl_filename }}
run: |
pip install ${{ needs.build-odm.outputs.whl_filename }}
pip install ${{ needs.build-ods.outputs.whl_filename }}

- name: Install test deps
run: pip install -r tests/requirements.in

- name: Run tests
run: pytest -v
run: pytest -v
23 changes: 23 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
ODS_Tools Changelog
===================

`3.2.0`_
---------
* [#78](https://github.com/OasisLMF/ODS_Tools/pull/78) - Release 3.1.4
* [#80](https://github.com/OasisLMF/ODS_Tools/pull/80) - Added fields to analysis settings schema
* [#81](https://github.com/OasisLMF/ODS_Tools/pull/81) - Add vulnerability adjustments field to schema
* [#82](https://github.com/OasisLMF/ODS_Tools/pull/83) - Enable additional properties for additional assets in model_settings.json
* [#72, #55](https://github.com/OasisLMF/ODS_Tools/pull/84) - Remove warning message
* [#85](https://github.com/OasisLMF/ODS_Tools/pull/86) - Add api run_mode, model running on (v1 / v2), to model settings
* [#88](https://github.com/OasisLMF/ODS_Tools/pull/88) - Lot3 integration with ODS-tools package
* [#89](https://github.com/OasisLMF/ODS_Tools/pull/89) - Fix CI workflow default branches
.. _`3.2.0`: https://github.com/OasisLMF/ODS_Tools/compare/3.1.4...3.2.0

`3.2.0`_
---------
* [#78](https://github.com/OasisLMF/ODS_Tools/pull/78) - Release 3.1.4
* [#80](https://github.com/OasisLMF/ODS_Tools/pull/80) - Added fields to analysis settings schema
* [#81](https://github.com/OasisLMF/ODS_Tools/pull/81) - Add vulnerability adjustments field to schema
* [#82](https://github.com/OasisLMF/ODS_Tools/pull/83) - Enable additional properties for additional assets in model_settings.json
* [#72, #55](https://github.com/OasisLMF/ODS_Tools/pull/84) - Remove warning message
* [#85](https://github.com/OasisLMF/ODS_Tools/pull/86) - Add api run_mode, model running on (v1 / v2), to model settings
* [#88](https://github.com/OasisLMF/ODS_Tools/pull/88) - Lot3 integration with ODS-tools package
.. _`3.2.0`: https://github.com/OasisLMF/ODS_Tools/compare/3.1.4...3.2.0

.. _`3.1.4`: https://github.com/OasisLMF/ODS_Tools/compare/3.1.3...3.1.4

`3.1.3`_
Expand Down
2 changes: 1 addition & 1 deletion ods_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '3.1.4'
__version__ = '3.2.0'

import logging

Expand Down
46 changes: 46 additions & 0 deletions ods_tools/data/analysis_settings_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,52 @@
}
}
},
"vulnerability_adjustments": {
"type": "object",
"title": "Vulnerability Adjustments",
"description": "Object containing vulnerability adjustments and replacements.",
"properties": {
"adjustments": {
"type": "object",
"title": "Vulnerability Factor Adjustments",
"description": "Dictionary containing vulnerability adjustments with vulnerability ID as integer keys and adjustment factors as float values.",
"patternProperties": {
"^[0-9]+$": {
"type": "number",
"minimum": 0
}
},
"additionalProperties": false
},
"replace_data": {
"type": "object",
"title": "Vulnerability Replacements",
"description": "Detailed vulnerability replacements.",
"patternProperties": {
"^[0-9]+$": {
"type": "array",
"items": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": [
{ "type": "integer" },
{ "type": "integer" },
{ "type": "number", "minimum": 0, "maximum": 1 }
]
}
}
},
"additionalProperties": false
},
"replace_file": {
"type": "string",
"title": "Vulnerability Replacement File",
"description": "Path to a CSV file containing vulnerability data to be replaced."
}
},
"additionalProperties": false
},
"gul_output": {
"type": "boolean",
"title": "Produce GUL output",
Expand Down
137 changes: 136 additions & 1 deletion ods_tools/data/model_settings_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
"description":"The version ID for the model. (optional)",
"minLength":1
},
"model_run_mode": {
"type":"string",
"title":"Model Run Model",
"description":"OasisPlatform execution mode for running an analysis, V1 = 'Single server execution' (worker versions `1.x.x` or `2.3.x`) , V2 = 'Distributed execution' scale an analysis across multiple nodes (Only workers `2.3.x` and above)",
"enum":[
"V1",
"V2"
]
},
"model_configurable": {
"type":"boolean",
"title":"Model configurable",
Expand Down Expand Up @@ -389,6 +398,86 @@
"options"
]
},
"vulnerability_set":{
"title":"Vulnerability set selector",
"description":"The 'id' field from options is used as a file suffix, e.g. vulnerability_<id>.bin, vulnerability_<id>.csv, vulnerability_<id>.parquet",
"type":"object",
"uniqueItems":false,
"additionalProperties": false,
"properties":{
"name":{
"type":"string",
"title":"UI Option",
"description":"UI name for selection",
"minLength":1
},
"desc":{
"type":"string",
"title":"Short description",
"description":"UI description for selection"
},
"used_for":{
"type":"string",
"title":"Where the setting is applied",
"description":"Set if this parameter is ONLY used at input 'generation' or for output 'losses'",
"enum":[
"all",
"generation",
"losses"
]
},
"tooltip":{
"type":"string",
"title":"UI tooltip",
"description":"Long description (optional)"
},
"default":{
"type":"string",
"title":"Default footprint set",
"description":"Initial setting for vulnerability set"
},
"options":{
"type":"array",
"title":"Selection options for footprint",
"description":"Array of possible vulnerability sets",
"items":{
"type":"object",
"title":"Selection option element",
"description":"Vulnerability set options",
"additionalProperties":false,
"properties":{
"id":{
"type":"string",
"title":"Vulnerability set suffix",
"description":"String value used to select a vulnerability set",
"minLength":1
},
"desc":{
"type":"string",
"title":"Vulnerability set description",
"description":"UI description for selection",
"minLength":1
},
"tooltip":{
"type":"string",
"title":"UI tooltip",
"description":"Long description (optional)"
}
},
"required":[
"id",
"desc"
]
}
}
},
"required":[
"name",
"desc",
"default",
"options"
]
},
"valid_output_perspectives":{
"type":"array",
"title":"Globally supported loss perspectives",
Expand Down Expand Up @@ -449,6 +538,52 @@
]
}
},
"vulnerability_adjustments": {
"type": "object",
"title": "Vulnerability Adjustments",
"description": "Object containing vulnerability adjustments and replacements.",
"properties": {
"adjustments": {
"type": "object",
"title": "Vulnerability Factor Adjustments",
"description": "Dictionary containing vulnerability adjustments with vulnerability ID as integer keys and adjustment factors as float values.",
"patternProperties": {
"^[0-9]+$": {
"type": "number",
"minimum": 0
}
},
"additionalProperties": false
},
"replace_data": {
"type": "object",
"title": "Vulnerability Replacements",
"description": "Detailed vulnerability replacements.",
"patternProperties": {
"^[0-9]+$": {
"type": "array",
"items": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": [
{ "type": "integer" },
{ "type": "integer" },
{ "type": "number", "minimum": 0, "maximum": 1 }
]
}
}
},
"additionalProperties": false
},
"replace_file": {
"type": "string",
"title": "Vulnerability Replacement File",
"description": "Path to a CSV file containing vulnerability data to be replaced."
}
},
"additionalProperties": false
},
"string_parameters":{
"title":"Single string paramters",
"type":"array",
Expand Down Expand Up @@ -1186,7 +1321,7 @@
"type":"object",
"title":"Assets Details",
"description":"Name, version and location of data",
"additionalProperties":false,
"additionalProperties":true,
"properties":{
"name":{
"type":"string",
Expand Down
3 changes: 2 additions & 1 deletion ods_tools/oed/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ def fill_empty(df, columns, value):
if isinstance(columns, str):
columns = [columns]
for column in columns:
if df[column].dtypes.name == 'category' and value not in {None, np.nan}.union(df[column].cat.categories):
dtype = getattr(df[column], "dtypes", getattr(df[column], "dtype", None))
if dtype.name == 'category' and value not in {None, np.nan}.union(df[column].cat.categories):
df[column] = df[column].cat.add_categories(value)
df.loc[df[column].isin(BLANK_VALUES), column] = value

Expand Down
Loading