Skip to main content

No project description provided

Project description

Diagnostipy



Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License

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 SymptomRule with 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

(back to top)


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

(back to top)

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 the confidence_function parameter when creating the Evaluator

(back to top)

Roadmap

  • Add support for more built-in confidence functions.
  • Improve error handling.
  • Expand the API to include more user-friendly options.

(back to top)

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/some-feature)
  3. Commit your Changes (git commit -m 'Add some feature')
  4. Push to the Branch (git push origin feature/some-feature)
  5. Open a Pull Request

Top contributors:

(back to top)

License

Diagnostipy is distributed under the MIT License.

(back to top)

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

diagnostipy-0.1.2.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

diagnostipy-0.1.2-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

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

Hashes for diagnostipy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 93b55ee9cbb31332fb4a62fd8febcc81c584da7e8de683c2c8b72781089d60cc
MD5 eeb952558c0babfc73a7db099868bc31
BLAKE2b-256 efabe950abcf947c57ba98b4b5cf65df520def1c0bd5ebd34ecc5bc3104c8f1b

See more details on using hashes here.

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

Hashes for diagnostipy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 30dce613fa2a07c0a58c9b2cf9fb272e89b866239cdfddb8ffa82e1af9959b88
MD5 a622e9f4f9b64cb837c29a0931858a29
BLAKE2b-256 e2a6684818d82aca4615c38a859f3494073cd0ebfecd8ff792528f3a892e2431

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