Skip to main content

A Python library for Statistical Process Control (SPC) analytics.

Project description

SFT Data Science Logo

spychart

spychart is a Python library for Statistical Process Control (SPC), developed to support analytics at Somerset Foundation Trust. It provides a centralised and flexible framework for monitoring healthcare time series data.

The package supports a range of SPC chart types (including X, moving range, and p-charts) and can be extended further with custom functions. It supports multiple changepoints, allowing control line re-calculation following system changes (e.g., ward reconfigurations). spychart can also account for seasonal variation by calculating separate control limits for each seasonal period, negating the need to separate data into multiple charts.

Installation

To install spychart using pip:

pip install spychart

Simple Usage

from spychart import SPC, spc_functions, spc_plots

# Instantiate SPC object
spc_example = SPC(data_in=df, # df is a Pandas.DataFrame (with DateTimeIndex)
                  target_col="value") # column name in data_in

# Process changepoint
spc_example.add_process_change_date(
    change_date="2020-08-01"
)

# Calculating control lines and storing results in a Pandas DataFrame
example_data = spc_example.calculate_spc(
    spc_calc_func=spc_functions.x_chart,  # importing X-chart
    rule_1=True) # SPC rules bool

# Pass in dataframe to create SPC chart
fig, ax = spc_plots.seaborn_chart(example_data)

For more examples, refer to the Example Notebook

Contributing

Pull requests are welcome. Otherwise, feel free to open an issue to discuss changes you would like to make.

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

spychart-1.0.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

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

spychart-1.0.0-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file spychart-1.0.0.tar.gz.

File metadata

  • Download URL: spychart-1.0.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.8

File hashes

Hashes for spychart-1.0.0.tar.gz
Algorithm Hash digest
SHA256 053fd07b273ca027b856d1157e67b71c0f60af6e082f8d2566b4d488650328ed
MD5 880e57c2bc375101440b12c63ee7858b
BLAKE2b-256 df782b0ea3643d49970484df2b32578a174ed5f086dd3c800a9733d0ae5451bb

See more details on using hashes here.

File details

Details for the file spychart-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: spychart-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.8

File hashes

Hashes for spychart-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ccc9a45c40c410cb885534f588fd5e0a48eab5c634e51028525e5906ec06f94
MD5 869369ab5db0105ee4e46f084ac2821c
BLAKE2b-256 0f6a126c5b7db7284cc7405f366f53427fb258fbf1c3ca9c09326b7cd1ffec6f

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