No project description provided
Project description
Diagnostipy
Table of Contents
About The Project
Diagnostipy is a open-source, Python library for rule-based diagnosis and evaluation. It allows users to define rules with conditions and weights, manage rulesets, and evaluate input data using customizable scoring and confidence functions.
Features
- Define rules using
SymptomRulewith customizable conditions, weights, and criticality. - Manage collections of rules via
SymptomRuleset. - Evaluate data using built-in or custom scoring and confidence functions with
Evaluator. - Flexible and extensible API.
When Should I Use Diagnostipy?
- When interpretability is more important than accuracy, and you need a clear, rules-based system to explain decision-making
- If you lack access to large datasets for training machine learning models but still require a structured evaluation or diagnostic tool
- When collaborating with domain experts to formalize diagnostic or evaluation criteria without a data-driven approach
- When working in regulated industries or domains where decisions must be auditable and transparent
- For quick prototyping of logic-based systems without the overhead of complex data pipelines
Getting Started
To get a local copy up and running, follow these steps.
Prerequisites
- Python 3.10 or later
Installation
Install Diagnostipy using pip:
pip install diagnostipy
Usage
Define Rules
from diagnostipy.core.models.symptom_rule import SymptomRule
rule_high_fever = SymptomRule(
name="High Fever",
weight=6.0,
critical=True,
apply_condition=lambda data: data.get("temperature", 0) >= 39,
)
rule_cough = SymptomRule(
name="Persistent Cough",
weight=4.0,
critical=False,
apply_condition=lambda data: data.get("cough", False),
)
rule_sore_throat = SymptomRule(
name="Sore Throat",
weight=5.0,
critical=True,
apply_condition=lambda data: data.get("sore_throat", False),
)
Create Ruleset
from diagnostipy import SymptomRuleset
ruleset = SymptomRuleset([rule_high_fever, rule_cough, rule_sore_throat])
Evaluate data
from diagnostipy import Evaluator
data = {
"temperature": 39.5,
"cough": True,
"sore_throat": False,
}
evaluator = Evaluator(ruleset)
results = evaluator.run(data=data)
print(results)
total_score=10.0 label='High' confidence=0.8333333333333334 metadata=None
Explanation of Output:
-
total_score: Sum of weights from applicable rules based on the input data. Here,6.0 (High Fever)+4.0 (Persistent Cough)=10.0. -
label: Categorical result based on total_score (e.g., 'Low', 'High'). Determined by the evaluation function used. -
confidence: A measure of certainty about the evaluation result, computed based on the logic defined in theconfidence_functionparameter when creating theEvaluator
Roadmap
- Add support for more built-in confidence functions.
- Improve error handling.
- Expand the API to include more user-friendly options.
Contributing
We are open to, and grateful for, any contributions made by the community.
A huge thank you to all the contributors.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/some-feature) - Commit your Changes (
git commit -m 'Add some feature') - Push to the Branch (
git push origin feature/some-feature) - Open a Pull Request
Top contributors:
License
Diagnostipy is distributed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file diagnostipy-0.1.2.tar.gz.
File metadata
- Download URL: diagnostipy-0.1.2.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.8.0-47-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93b55ee9cbb31332fb4a62fd8febcc81c584da7e8de683c2c8b72781089d60cc
|
|
| MD5 |
eeb952558c0babfc73a7db099868bc31
|
|
| BLAKE2b-256 |
efabe950abcf947c57ba98b4b5cf65df520def1c0bd5ebd34ecc5bc3104c8f1b
|
File details
Details for the file diagnostipy-0.1.2-py3-none-any.whl.
File metadata
- Download URL: diagnostipy-0.1.2-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.8.0-47-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30dce613fa2a07c0a58c9b2cf9fb272e89b866239cdfddb8ffa82e1af9959b88
|
|
| MD5 |
a622e9f4f9b64cb837c29a0931858a29
|
|
| BLAKE2b-256 |
e2a6684818d82aca4615c38a859f3494073cd0ebfecd8ff792528f3a892e2431
|