Skip to main content

Build and analyze a network model of hazards, causes, and controls

Project description

hazard-map

screenshot

Build a network model from spreadsheets of hazard, cause, and control mappings and carry out useful analyses.

Overview

This is a simple command-line tool that takes an Excel workbook with tables of mappings and creates a network model to use for analyses and visualization.

Installation

Install the command-line application from PyPI with pip:

pip install hazard-map

Usage

Use the -h flag to see the available options:

hazard-map -h
usage: hazard-map [-h] [-o OUTPUT_DIRECTORY] [-j | --output-json | --no-output-json] [-m MAPPING_REGEX] [-d PLOT_DPI] input_workbook

Build and analyze a network model of hazards, causes, and controls

positional arguments:
  input_workbook        The hazard mapping excel file to evaluate

options:
  -h, --help            show this help message and exit
  -o OUTPUT_DIRECTORY, --output-directory OUTPUT_DIRECTORY
                        Set a directory for the script to save its outputs to
  -j, --output-json, --no-output-json
                        Save a json description of the mappings alongside the hazard log
  -m MAPPING_REGEX, --mapping-regex MAPPING_REGEX
                        Set a custom regex for identifying mapping pairs
  -d PLOT_DPI, --plot-dpi PLOT_DPI
                        Set a custom DPI (quality) for the plot output

Pass an Excel workbook (xlsx) file with hazard-cause and cause-control mappings (indicated by a "Y" at the intersection of row/column pair that map onto one-another) in worksheets named "HazardCause Mapping" and "CauseControl Mapping" respectively:

hazard-map our_mappings.xlsx

See the test mappings for an example of a compatible document.

Development

If you want to develop this project further or just set it up so you can modify the source code (to work with a different matrix format, for example), clone this repo:

git clone https://gitlab.com/thom-cameron/hazard-map
cd hazard-map

Packaging and dependency management for this project are handled by poetry. Install poetry, or, if you use nix, start up a shell with everything you need:

nix-shell

Then, get the code running:

# install dependencies
poetry install

# run the test suite
poetry run pytest

# run the application
poetry run hazard-map

# or enter an interactive shell in a properly configured virtual environment
poetry run python

Project details


Download files

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

Source Distribution

hazard_map-0.3.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

hazard_map-0.3.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file hazard_map-0.3.0.tar.gz.

File metadata

  • Download URL: hazard_map-0.3.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/5.15.154+

File hashes

Hashes for hazard_map-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7f32a2cc6a83b737d927e0e46ca8cf06a85c2980afb79d9336c1a536a2896a68
MD5 cdb4185c472d0a8b460a08e75d1b50b2
BLAKE2b-256 e815d0b28608a40e9403b4a1e234627945220c9a22c5ac1ff0f2039c17767646

See more details on using hashes here.

File details

Details for the file hazard_map-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: hazard_map-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/5.15.154+

File hashes

Hashes for hazard_map-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1fce58a744ec2358e422d4cfb924dcd643598d1955771f666624659c2b461d6b
MD5 f16596426a2d0e82701f4102c7f7b0d2
BLAKE2b-256 b43d5fc1401fc7f9632af4d4e26ea4cf26e76d95917d99ad32f3c680d323af92

See more details on using hashes here.

Supported by

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