Python Simple decision table procesor
Install
pysidetap is available on PyPI pypi-pysidetap and you can install it using pip:
`sh pip install pysidetap `
Summary
Simple Decision Table Processor
https://en.wikipedia.org/wiki/Decision_table
- This function find and return field ‘return’ from Decision Table,
when all operands in row by ‘fields’ are True.
Example:
This example show use case off Traffic lights decisions.
https://en.wikipedia.org/wiki/Traffic_light#Meanings_of_signals
Decision Table:
red |
yellow |
green |
return |
|---|---|---|---|
==on |
==off |
==off |
stop |
==on |
==on |
==off |
ready |
==off |
==off |
==on |
go |
==off |
==on |
==off |
break |
==off |
==off |
==off |
off |
from pysidetap.processor import DTProcessor
DTableTL = [
{
'fields': {
'red': {'op':'==', 'value':'on'},
'yellow': {'op':'==', 'value':'off'},
'green': {'op':'==', 'value':'off'},
},
# Traffic may not proceed beyond the stop line or
# otherwise enter the intersection
'return': {'stop'}
},
{
'fields': {
'red': {'op':'==', 'value':'on'},
'yellow': {'op':'==', 'value':'on'},
'green': {'op':'==', 'value':'off'},
},
# The signal is about to change, but the red light rules do apply
'return': {'ready'}
},
{
'fields': {
'red': {'op':'==', 'value':'off'},
'yellow': {'op':'==', 'value':'off'},
'green': {'op':'==', 'value':'on'},
},
# Traffic may not pass the stop line or enter the intersection
# unless it cannot safely stop when the light shows
'return': {'go'}
},
{
'fields': {
'red': {'op':'==', 'value':'off'},
'yellow': {'op':'==', 'value':'on'},
'green': {'op':'==', 'value':'off'},
},
# Traffic may proceed unless it would not clear the intersection
# before the next change of phase
'return': {'break'}
},
{
'fields': {
'red': {'op':'==', 'value':'off'},
'yellow': {'op':'==', 'value':'off'},
'green': {'op':'==', 'value':'off'},
},
# Traffic lights is off
'return': {'off'}
},
]
p = DTProcessor(DTableTL)
for red in ['on','off']:
for yellow in ['on','off']:
for green in ['on','off']:
result = p.process({'red':red, 'yellow':yellow, 'green':green})
print(f'red: {red}, yellow: {yellow}, green: {green}, result:{result}')
Issues and Discussions
As usual for any GitHub-based project, raise an issue if you find any bug or want to suggest an improvement, or open a discussion if you want to discuss or chat :wink:
Version
v0.0.10
Changelog
v0.0.10 (2023-12-22)
v0.0.9 (2023-12-22)
v0.0.8 (2023-12-22)
v0.0.7 (2023-12-22)
v0.0.6 (2023-12-22)
v0.0.5 (2023-12-22)
v0.0.4 (2023-01-08)
documentation update
added traffic lights example
v0.0.3 (2023-01-05)
documentation update
v0.0.2 (2023-01-05)
First release on PyPI.
v0.1.0 (2023-01-05)
Metadata
Release files for pysidetap 0.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pysidetap-0.0.10.tar.gz | 22.5 kB | Without provenance | Details for pysidetap-0.0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pysidetap-0.0.10-py3-none-any.whl | Python 3 | none | any | Details for pysidetap-0.0.10-py3-none-any.whl |
Total release size: 29.1 kB
Release files / pysidetap-0.0.10.tar.gz
| Download URL | pysidetap-0.0.10.tar.gz |
|---|---|
| Size | 22.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6805e5723ac1987c0e136d36904cb062f680b29fbd82792f75dfe93783b1b380
|
|
BLAKE2b-256 checksum How to use checksums |
ea93b65a3109e7d1f27b3c528dbfd7cfe8456bd7834b9c762b9592281c6b6661
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.1
|
Release files / pysidetap-0.0.10-py3-none-any.whl
| Download URL | pysidetap-0.0.10-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c94f09d47f58dccd9f8a7c6e19db546193e456f315e33b981e5e1bf0cbdd3471
|
|
BLAKE2b-256 checksum How to use checksums |
b07bbd25140c00f4bde36943b01b8484ee64bfc7245f036d47e96d5033c94667
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.1
|
Security for pysidetap 0.0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.