DEV Community

Swapin Vidya
Swapin Vidya

Posted on

PeachBot Models Medi: A Deterministic Clinical Input Structuring Layer for Edge AI Systems

⚠️ Scope & Medical Disclaimer

This repository represents an input understanding layer within the PeachBot system.

It is:

  • Not a diagnostic system
  • Not a treatment recommendation system
  • Not a decision-making engine

This module is responsible only for structuring clinical input into a deterministic format.

Outputs are structured data representations and must not be interpreted as medical advice.


What PeachBot Models Medi Is

PeachBot Models Medi is a clinical input structuring framework.

It converts:

Raw Input (text / speech)
        ↓
Structured Clinical State (JSON)
Enter fullscreen mode Exit fullscreen mode

This structured output is then consumed by the reasoning layer.


Why This Exists

Most systems underestimate input processing:

text → model → output
Enter fullscreen mode Exit fullscreen mode

But real-world input is:

  • Noisy
  • Ambiguous
  • Context-dependent

This layer ensures:

Clean, structured, and validated input before any reasoning occurs.


Role in PeachBot System

User Input
    ↓
PeachBot Models Medi  ← (THIS LAYER)
    ↓
Structured Clinical State
    ↓
PeachBot Core (Reasoning)
    ↑
PeachBot Medical KG (Knowledge)
Enter fullscreen mode Exit fullscreen mode

🔍 CLI Demonstration (Real Output)

Below is an actual run of the system:

Input: "chest pan 5 days"

Output:
{
  "symptoms": [
    {
      "name": "chest_pain",
      "duration": "5 days",
      "present": true
    }
  ],
  "meta": {
    "confidence": 0.8
  }
}
Enter fullscreen mode Exit fullscreen mode

Key observations:

  • Handles typos (pan → pain)
  • Extracts duration
  • Produces structured output
  • Maintains deterministic behavior

Processing Pipeline

Input
 ↓
Text Cleaning
 ↓
Context Segmentation
 ↓
Symptom Extraction
 ↓
Normalization
 ↓
Negation Detection
 ↓
Attribute Extraction
 ↓
Merge & Validation
 ↓
Structured Output
Enter fullscreen mode Exit fullscreen mode

Core Capabilities

Clinical Language Understanding

  • Supports patient and clinical phrasing
  • Handles noisy real-world input

Deterministic Processing

  • No randomness
  • Repeatable outputs

Negation Handling (Critical)

  • "no fever" → correctly interpreted
  • Segment-aware logic

Attribute Extraction

Captures:

  • Duration
  • Severity
  • Trend

What This Layer Does NOT Do

  • ❌ Diagnosis
  • ❌ Treatment recommendation
  • ❌ Clinical reasoning
  • ❌ Risk scoring

Installation

git clone https://github.com/peachbotAI/peachbot-models-medi.git
cd peachbot-models-medi

python -m venv venv
source venv/Scripts/activate

pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

Run CLI

python -m api.cli
Enter fullscreen mode Exit fullscreen mode

Testing

pytest -v
Enter fullscreen mode Exit fullscreen mode

What Currently Works

  • Symptom extraction
  • Negation detection
  • Normalization
  • Structured JSON output
  • CLI interaction

Current Limitations

  • Limited medical vocabulary coverage
  • English-only (currently)
  • Rule-heavy system
  • Requires tuning for edge deployment

Design Approach

This system is built with:

  • Deterministic logic
  • Explainable transformations
  • Config-driven pipelines
  • Strict separation from reasoning

Where This Can Be Used (Exploratory)

  • Clinical preprocessing systems
  • Edge healthcare pipelines
  • Structured data extraction
  • Explainable AI systems

(Exploratory use only)


🤝 Contributing

This module is designed to be extended.

You Can Contribute By:

  • Improving extraction rules
  • Expanding normalization maps
  • Enhancing negation detection
  • Adding multilingual support

Rules

  • Keep outputs deterministic
  • Avoid black-box logic
  • Maintain strict separation from reasoning

Repository

👉 https://github.com/peachbotAI/peachbot-models-medi


Final Note

This is not an AI that decides.

It is a system that ensures:

Correct input → enables reliable reasoning

Within PeachBot:

Understanding comes before intelligence.

Top comments (0)